const Loggers = require('@goodware/log');
const options = {
stage: process.env.NODE_ENV, // This is the value for the 'stage' property that appears in all
// log entries (aka meta property)
service: 'Example', // The name of this program (another meta property)
version: '1.0.0', // The program's version (another meta property)
commitSha: 'RunKit Example (no git repo)',
console: {
colors: true, // Create visually appealing console entries with ANSI colors. The color of each
// logging level can be specified. true is the default.
data: true, // Send all logged data (including stack traces) to the console, not just the message
},
cloudWatch: {
// This is provided as an example only. In order to log to CloudWatch Logs, your environment
// must be configured to use the AWS SDK.
region: 'us-west-2', // This is optional. The following environment variables will be
// used, if set, in the following order:
// AWS_CLOUDWATCH_LOGS_REGION; AWS_REGION
logGroup: `/${process.env.NODE_ENV}/goodware/log`,
},
categories: {
// These are named loggers aka Winston categories. Each category can specify which transports
// to use: console, file, or cloudWatch, and at which logging level. All categories inherit
// from the default category. Logging levels are configurable. By default they are:
// fail, error, warn, notice, info, more, db, http, verbose, debug, silly
default: {
console: 'silly',
cloudWatch: 'off',
file: 'off',
errorFile: 'off',
},
briefConsole: {
console: {
level: 'info',
data: false,
},
},
},
};
// loggers is shared with other code cells
let loggers;
capcon.captureStdout(() => {
loggers = new Loggers(options);
});