-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add kitchensink example generator and screenshot to readme
- Loading branch information
Showing
4 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {childLogger, loggerApp, loggerDebug} from '../src/index.js' | ||
import {ErrorWithCause} from "pony-cause"; | ||
import process from "process"; | ||
import path from 'path'; | ||
|
||
const initLogger = childLogger(loggerDebug, 'Init'); | ||
initLogger.info('Initializing Application -> v1.3.1'); | ||
initLogger.debug('Debug logging is enabled!'); | ||
initLogger.debug(`Found Log Config at ${path.resolve(process.cwd(), './config.yaml')}`) | ||
|
||
const appLogger = loggerApp({file: false}); | ||
const logger = childLogger(appLogger, 'App'); | ||
logger.verbose(`Logging to -> ${path.resolve(process.cwd(), './logs/app.log')}`); | ||
|
||
const nestedChild1 = childLogger(logger, 'Service A'); | ||
nestedChild1.log('Starting monitoring for events...'); | ||
|
||
const nestedChild2 = childLogger(nestedChild1, ['Queue', 'Parser']); | ||
nestedChild2.warn('Unexpected contents found in event, skipping'); | ||
|
||
const siblingLogger = childLogger(logger, ['Service B', 'Manager']); | ||
siblingLogger.info('Widget allocation has initiated'); | ||
|
||
logger.debug({myProp: 'a string', nested: {anotherProps: ['val1', 'val2'], boolProp: true}}, 'Test'); | ||
|
||
const er = new Error('A configuration error occurred'); | ||
const causeErr = new ErrorWithCause('Service C did not start', {cause: er}); | ||
logger.error(causeErr); | ||
|
||
logger.verbose('(1) service failed to start but is non-essential...continuing startup') | ||
logger.info('Application successfully started and running!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters