asljs-logging
v0.1.1
Published
Structured logging provider abstraction for ASLJS packages.
Maintainers
Readme
logging
Part of Alexandrite Software Library – a set of high‑quality, performant JavaScript libraries for everyday use.
Defines logging abstractions and provides implementation of these abstractions with Pino logger.
Installation
npm install asljs-loggingNPM Package: asljs-logging
Usage
import {
PinoLoggerProvider,
PinoLoggerProviderOptionsBuilder
} from 'asljs-logging';
const options = new PinoLoggerProviderOptionsBuilder()
.fromEn('MY_APP_LOG_')
.build();
await using loggerProvider = createPinoLoggerProvider(
{ level: 'information', envVarPrefix: 'MY_APP_LOG_' }
);
const logger = loggerProvider.getLogger(
'my-context'
);
logger.information(
'started'
);Environment Variables
By default, createPinoLoggerProvider() uses ASLJS_LOG_ and reads:
ASLJS_LOG_LEVELASLJS_LOG_FILE
The prefix can be overridden by envVarPrefix option or
ASLJS_LOG_ENV_VAR_PREFIX.
License
MIT License. See LICENSE for details.
