@optahaul/logger
v0.0.2
Published
optahaul node logger
Downloads
119
Readme
OptaHaul Node Logger
- Set
NODE_ENV
env variable tolocal
to getsimple
logging, otherwise it will bejson
. - Set log level by defining
LOG_LEVEL
env variable or callingLogger.setLogLevel('info')
. Default log level isinfo
. - Get current log levels by calling
Logger.isDebugEnabled()
etc.
Basic usage
import { Logger } from '@optahaul/logger';
export class ExampleService {
private static logger = new Logger(ExampleService.name);
exampleFunction() {
ExampleService.logger.info('hi');
}
}
Typeorm support
import { TypeormLogger } from '@optahaul/logger';
const connection = await createConnection({
...options,
logger: new TypeormLogger(),
});
Publish package
npm login
npm ci
npm run build
npm publish