1.0.29 • Published 8 months ago

nhebo-logger v1.0.29

Weekly downloads
144
License
UNLICENSED
Repository
bitbucket
Last release
8 months ago

nhebo-logger

This package provides common logging utilities for Nhebo projects.

license: Copyright � Nhebo LLC - All Rights Reserved source: https://bitbucket.org/nhebo/library/src/master/nhebo-logger/ URL: https://www.npmjs.com/package/nhebo-logger chat: Nhebo Slack

Table of Contents


Installation

Install the package in any Nhebo project directly with:

npm install nhebo-logger

Usage

// Set config and logger
const config = { label: 'Nhebo-API' };
const logger = require('nhebo-logger')(config);

// Then use console.log as normal
console.emergency('system down. come to the office NOW!');
console.alert('sharks will attack soon. watch out.');
console.error('sharks are attacking. fix me.');
console.warning('sharks may attack. watch out.');
console.info('it was actually snakes on a plane.');
console.debug('line 32: shark was a snake.');

Note: in production, logs will be logged to the file system. In all other environments, logs will be sent to the console.

Warning levels

  • Emergency: critical system down. Wake me up at 3 am.
  • Alert: something may be wrong. Check within 24 hours.
  • Error: error message that something is wrong. Check within 24 hours.
  • Warning: warning message.
  • Info: informational message. Can be used for historical purposes.
  • Debug: debugging message. Used in local development for testing.

Logger configuration

The logger config object contains optional parameters for configuring your logger.

  • label: this is the label of the source. Defaults to Nhebo-Project
  • timestamp: this is the format that you want for the timestamps associated with every log. Defaults to YYYY-MM-DD HH:mm:ss
  • format: this is the format you want your logger to output in. Available options: logstash, file, console, json. Defaults to json
  • level: this is the log warning level you want to output. Defaults to info

Example

// First declare config
const config = { label: 'Nhebo-API', timestamp: 'YYYY-MM-DD HH:mm:ss' };

// Then use when you instantiate the logger
const logger = require('nhebo-logger')(config);

Tests

npm test

Publish

When you are ready to upload your fixes to npm, use the following to publish your package to the npm repository for nhebo. Please note that you must first login to npm via npm login for this command to work

npm publish

Contact

Team Nhebo Slack

License

Copyright (c) Nhebo LLC - All Rights Reserved.
Confidential, Proprietary and Trade Secrets Notice

Use of this software is governed by a license agreement. This software contains confidential, proprietary and trade secret information of Nhebo LLC and/or one of its subsidiaries and is protected under United States and international copyright and other intellectual property laws. Use, disclosure, reproduction, modification, distribution, or storage in a retrieval system in any form or by any means is prohibited without the prior express written permission of Nhebo LLC.

1.0.29

8 months ago

1.0.28

9 months ago

1.0.27

10 months ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago