npm install @tincre/loggerimport { logger } from '@tincre/logger';
logger.debug('Debugging message');
logger.log('Application started');
logger.warn('This is a warning');
logger.error('Unexpected error occurred', new Error('Something went wrong'));Logs a standard message to the console if NODE_ENV is not set to production.
message: string - The main log message.data(optional): unknown - Additional data (object, array, string, etc.).
logger.log('User logged in', { userId: 123 });Logs an error message to the console if NODE_ENV is not set to production.
message: string - The error message.data(optional): unknown - Additional error details.
logger.error('Database connection failed', new Error('Connection timeout'));Logs a warning message to the console if NODE_ENV is not set to production.
message: string - The warning message.data(optional): unknown - Additional details.
logger.warn('Low disk space', { availableGB: 2 });Logs a debug message to the console if NODE_ENV is not set to production.
message: string - The debug message.data(optional): unknown - Additional debug info.
logger.debug('Fetching API data', { endpoint: '/users', method: 'GET' });| Variable | Description |
|---|---|
NODE_ENV |
Set to "production" to disable logging in production environments. |
We welcome contributions! Please follow our commit guidelines and open issues if you encounter any problems.