nhebo-logger
v1.0.29
Published
Nhebo logger library
Downloads
87
Readme
nhebo-logger
This package provides common logging utilities for Nhebo projects.
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 toNhebo-Project
timestamp
: this is the format that you want for the timestamps associated with every log. Defaults toYYYY-MM-DD HH:mm:ss
format
: this is the format you want your logger to output in. Available options: logstash, file, console, json. Defaults tojson
level
: this is the log warning level you want to output. Defaults toinfo
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
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.