1.0.6 • Published 1 year ago

@tanuj_sahu_ts/winston-wrapper v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

winston-wrapper

A wrapper for the Winston logging library using ES6 syntax.

Installation

You can install this package using npm:

     npm install @tanuj_sahu_ts/winston-wrapper

## Example 

    import logger from '@tanuj_sahu_ts/winston-wrapper';


    logger.info('This is an info message');
    logger.warn('This is a warning message');
    logger.error('This is an error message');

    // Log with metadata
    logger.info('This is an info message with metadata', { userId: 123, operation: 'update' });
    logger.warn('This is a warning message with metadata', { userId: 456, operation: 'delete' });
    logger.error('This is an error message with metadata', { userId: 789, operation: 'create' });

 ## Output 
    {
    "timestamp": "2024-05-21T10:00:00.000Z",
    "level": "info",
    "message": "This is an info message"
    }

    {
    "timestamp": "2024-05-21T10:00:00.000Z",
    "level": "warn",
    "message": "This is a warning message"
    }

    {
    "timestamp": "2024-05-21T10:00:00.000Z",
    "level": "error",
    "message": "This is an error message"
    }

    {
    "timestamp": "2024-05-21T10:00:00.000Z",
    "level": "info",
    "message": "This is an info message with metadata",
    "data": { "userId": 123, "operation": "create" }
    }

    {
    "timestamp": "2024-05-21T10:00:00.000Z",
    "level": "warn",
    "message": "This is a warning message with metadata",
     "data": { "userId": 456, "operation": "create" }
    }

    {
    "timestamp": "2024-05-21T10:00:00.000Z",
    "level": "error",
    "message": "This is an error message with metadata",
    "data": { "userId": 789, "operation": "create" }
    }
1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago