nhebo-logger v1.0.29
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-loggerUsage
// 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-Projecttimestamp: this is the format that you want for the timestamps associated with every log. Defaults toYYYY-MM-DD HH:mm:ssformat: this is the format you want your logger to output in. Available options: logstash, file, console, json. Defaults tojsonlevel: 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 testPublish
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 publishContact
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.
12 months ago
1 year ago
1 year ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago