Skip to content

AnEntrypoint/sequential-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequential Logging

Consolidated logging for sequential-ecosystem packages.

Installation

npm install sequential-logging

Usage

import logger from 'sequential-logging';

logger.setLevel('INFO');
logger.info('Application started');
logger.warn('This is a warning', { code: 'WARN_001' });
logger.error('Operation failed', new Error('Something broke'));

Log Levels

  • DEBUG (0)
  • INFO (1)
  • WARN (2)
  • ERROR (3)

Methods

logger.setLevel('DEBUG');
logger.debug('Variable state', { x: 10 });
logger.info('User logged in', { userId: '123' });
logger.warn('Deprecated API', { api: 'oldMethod' });
logger.error('Failed', err, { context: 'data' });

Context

logger.setContext({ service: 'auth', version: '1.0' });
logger.addContext('requestId', '550e8400');

Output Formats

logger.setOutputFormat('cli');
logger.setOutputFormat('server');
logger.setOutputFormat('json');

Child Loggers

const childLogger = logger.child({ module: 'payment' });
childLogger.info('Processing');

Lazy Evaluation

logger.debug('Expensive data', () => computeExpensiveData());

License

MIT

About

Logging utilities for tasker ecosystem with multiple log levels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •