@storyous/logger
v1.2.6
Published
``` typescript import { initLogger } from '@storyous/logger';
Maintainers
Keywords
Readme
logger
Usage
import { initLogger } from '@storyous/logger';
const config = {
env: process.env.NODE_ENV,
logging: {
console: {
colorize: true,
// Use for localhost development only, it will output nicely readable logs
// and if error appears the stack will be clickable in webstorm
prettyOutput: true,
},
loggly: {
silent: true,
token: process.env.LOGGLY_TOKEN || '',
subdomain: 'storyous',
tags: ['serviceName', process.env.NODE_ENV],
json: true
},
sentry: {
dsn: process.env.SENTRY_DSN || '',
level: 'error',
silent: true
}
}
}
const logger = initLogger(config.env, config.logging);
// define new logger for specific module
const logModule = logger.module('extraLogger');
export default logger;Requirements
Node.js >= 22.
Transports
Loggly
Uses winston-loggly-bulk (the package named in Loggly's Node.js docs). Its dependency node-loggly-bulk pins [email protected],
which npm audit flags — see ADR 0001 for why this is
accepted (the only request is a POST of log data to a fixed Loggly URL; none of the advisories are reachable that way).
If you want a clean audit in your project, add to your root package.json (scoped, so your own axios is not affected):
"overrides": { "node-loggly-bulk": { "axios": "^1.20.0" } }Sentry
Uses @sentry/node 10. Only dsn (from sentry.dsn) and environment (from the env argument) are passed to Sentry.init.
Note that @sentry/node >= 8 instruments http/https via a global require hook when initialised; database and
framework instrumentation is only enabled when tracing is turned on (it is not).
Upgrading to 1.2.6
- Minimum Node.js version is 22.
@sentry/node6 → 10: no config changes needed for the documented options.- Loggly: unchanged (
winston-loggly-bulk), see the note above aboutnpm audit.
