0.0.13 • Published 19 days ago

@atp-autoteile/logger v0.0.13

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
19 days ago

ATP_Logger

Library, created for logging errors using Sentry

! IMPORTANT !

  • Library requires ATP_LOGGER_DSN env variable to log Sentry errors
  • ATP_LOGGER_ENV is required for specific Sentry environment ('production' by default)

  • APPLICATIONINSIGHTS_CONNECTION_STRING is required for Azure Application Insights service

  • run npm version <version_name> after every update

USAGE

Logger has 4 levels of logging

debug info warn error

Simply import the Logger and call info method to log a message:

import { Logger } from '@atp-autoteile/logger'

const logger = new Logger('service name')
logger.info<string>('Info message')

// loggig errors
try {
  throw new Error('Your custom message...'); 
}
catch (err) {
  logger.error(err);
}

For CommonJS module:

const { Logger } = require('@atp-autoteile/logger')

const logger = new Logger('service name')
logger.info('Info message')

Set a service name as a parameter for constructor when creating new Logger instance if you want to use custom log message prefix. Default value is 'ATP_Logger'

env parameters example:

ATP_LOGGER_DSN='https://******@sentry.io/12345'
ATP_LOGGER_ENV='staging'
APPLICATIONINSIGHTS_CONNECTION_STRING='InstrumentationKey=******;IngestionEndpoint=https://******.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/'
0.0.12

19 days ago

0.0.13

19 days ago

0.0.11

6 months ago

0.0.10

8 months ago

0.0.9

12 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago