logger used by rath finance
npm install @rathfi/logger
import { Logger } from '@rathfi/logger';
const logger = new Logger();
// Set log level (optional, defaults to INFO)
logger.setLogLevel('LOG');
function myFunction() {
// Basic logging
logger.log({ Id: '123', message: 'Processing started' });
try {
// ... your code ...
logger.debug({ Id: '123', status: 'success' });
} catch (error) {
logger.error({ Id: '123', error: error.message });
}
}
// Output format examples:
// myFunction(id=123,message=Processing started)
// debug_myFunction(id=123,status=success)
// error_myFunction(id=123,error=Something went wrong)
Available log levels (in order of priority):
- FATAL (0)
- ERROR (1)
- WARN (2)
- INFO (3) - default
- DEBUG (4)
- LOG (5) - regular logging
Set the minimum log level. Messages below this level will not be logged.
logger.fatal(params)
logger.error(params)
logger.warn(params)
logger.info(params)
logger.debug(params)
logger.log(params)
(alias for regular logging)
MIT