snooper

0.0.6 • Public • Published

NPM Module snooper

Snooper is an information tool to forward the logging information - usually sent only to console, to a REST-API you define. Additionally all information of the defined log levels will be displayed in console. Of course the log levels for console and posts can be set independant.

snoopy the cool snooper

Installation

To implementate this tool in your project:

    npm install snooper

Enviroment Variables

The host to forward information is controlled by the enviroment variable:

SNOOPER_FORWARD_LEVEL

By default, no message are forward to another host. If you want to change this, set the enviroment variable in comma-separated list.

export SNOOPER_FORWARD_LEVEL: fatal, error, warn

If you want to enable all log levels at once, you can provide * character as value.

export SNOOPER_FORWARD_LEVEL: *
SNOOPER_FORWARD_URL

Define the target-url to forward the information.

export SNOOPER_FORWARD_URL: http://myhost.com
LOG_LEVELS

Define the Log-Levels for the displayed message in the console. See Flaschenpost

Usage

The first parameter is the object to be logged and post ed to the Rest URI. The second parameter (boolean) is to activate and deactivate the forward-mechanism. If it is set to true, the message will be posted to the URI defined by the enviroment variable. If the second Param is not defined, it will be logged only to console.

const snooper = require('snooper');
 
 
snooper.fatal(object, true); /  / Text in console is blue
snooper.error(object, true);    // Text in console is red
snooper.warn(object, true);     // Text in console is yellow
snooper.info(object, true);     // Text in console is green
snooper.debug(object, false);    // Text in console is white, without forward to another service

Forward object

{
status: "fatal/error/warn/info/debug",
timestamp: "Unix-Timestamp",
statusobject: "your inserted object"
}

License

The MIT License (MIT) Copyright (c) 2015 Werbasinnotec.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

Package Sidebar

Install

npm i snooper

Weekly Downloads

6

Version

0.0.6

License

MIT

Last publish

Collaborators

  • mwiesmueller
  • bernhardmaier
  • joeherwig