Skip to main content
Deno 2 is finally here 🎉️
Learn more

Logger

Screenshot from 2023-12-28 16-43-21

Usage Example

import { Logger } from 'https://deno.land/x/log/mod.ts'
export const logger = await Logger.getInstance() // import this one in your sub modules

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 pureInfo = true // leaving out e.g. the time info

export const logger = await Logger.getInstance('DEBUG', 'WARNING', "./warnings-errors.txt", pureInfo)

logger.debug('example debug message')
logger.info('example info')
logger.warning('example warning')
logger.error('example error message')
logger.critical('example critical message') 

Donations

Thanks to Freedom Cash, we are already free.
If you want to donate, you might consider donating to the otherparty.co.uk to ensure people do not need to donate to victims but rather donate successfully to problem solvers.

direct-democracy