A frequently used log configuration. Adding Date Time. Adding warnings and errors to file. Infos are green.
Repository
Current version released
4 years ago
Dependencies
Logger
Frequently used configuration:
Writing warnings + errors into file. Adding date and time. Info Messages are green.
Usage Example
import { Logger } from 'https://deno.land/x/log/mod.ts'
const logger = await Logger.getInstance()
logger.debug('example debug message')
logger.info('example info')
logger.warning('example warning')
logger.error('example error message')
logger.critical('example critical message')
// warnings + errors are additionally written to ./warnings-errors.txt file
Trigger Usage Example
deno run --allow-read --allow-write https://deno.land/x/log/usage-example.ts
Advanced Usage
import { Logger } from 'https://deno.land/x/log/mod.ts'
const minLevelForConsole = 'DEBUG' // config.minLevelForConsole
const minLevelForFile = 'WARNING' // config.minLevelForFile
// const minLevelForConsole = 'INFO'
// const minLevelForFile = 'ERROR'
// const minLevelForFile = 'CRITICAL'
const fileName = "./warnings-errors.txt"
const logger = await Logger.getInstance(minLevelForConsole, minLevelForFile, fileName)
logger.debug('example debug message')
logger.info('example info')
logger.warning('example warning')
logger.error('example error message')
logger.critical('example critical message')
Support my Open Source Contributions
If you like my work please consider downloading the brave browser via my promotion link: https://brave.com/fan464.