0.0.5 • Published 11 months ago

@tincre/logger v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@tincre/logger

npm package
Build Status
Downloads
Issues
Code Coverage
Commitizen Friendly
Semantic Release

Install

npm install @tincre/logger

Usage

import { 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'));

API

logger.log(message, data?)

Logs a standard message to the console if NODE_ENV is not set to production.

Parameters:

  • message: string - The main log message.
  • data (optional): unknown - Additional data (object, array, string, etc.).

Example:

logger.log('User logged in', { userId: 123 });

logger.error(message, data?)

Logs an error message to the console if NODE_ENV is not set to production.

Parameters:

  • message: string - The error message.
  • data (optional): unknown - Additional error details.

Example:

logger.error('Database connection failed', new Error('Connection timeout'));

logger.warn(message, data?)

Logs a warning message to the console if NODE_ENV is not set to production.

Parameters:

  • message: string - The warning message.
  • data (optional): unknown - Additional details.

Example:

logger.warn('Low disk space', { availableGB: 2 });

logger.debug(message, data?)

Logs a debug message to the console if NODE_ENV is not set to production.

Parameters:

  • message: string - The debug message.
  • data (optional): unknown - Additional debug info.

Example:

logger.debug('Fetching API data', { endpoint: '/users', method: 'GET' });

Environment Variables

VariableDescription
NODE_ENVSet to "production" to disable logging in production environments.

Contributing

We welcome contributions! Please follow our commit guidelines and open issues if you encounter any problems.


0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago