
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
cinovo-logger
Advanced tools
___
__ /\_ \
___ /\_\ ___ ___ __ __ ___ \//\ \ ___ __ __ __ _ __
/'___\/\ \ /' _ `\ / __`\/\ \/\ \ / __`\ _______\ \ \ / __`\ /'_ `\ /'_ `\ /'__`\/\`'__\
/\ \__/\ \ \/\ \/\ \/\ \L\ \ \ \_/ |/\ \L\ \/\______\\_\ \_/\ \L\ \/\ \L\ \/\ \L\ \/\ __/\ \ \/
\ \____\\ \_\ \_\ \_\ \____/\ \___/ \ \____/\/______//\____\ \____/\ \____ \ \____ \ \____\\ \_\
\/____/ \/_/\/_/\/_/\/___/ \/__/ \/___/ \/____/\/___/ \/___L\ \/___L\ \/____/ \/_/
/\____/ /\____/
\_/__/ \_/__/
cinovo-logger is an async logger for Node.js with multiple endpoints.
npm install cinovo-logger
var logger = require("cinovo-logger");
There are some endpoints available:
You could also write your own endpoint (see Custom Endpoint).
If you wish to log to console just:
npm install cinovo-logger-console
In your JavaScript code append the endpoint.
logger.append(require("cinovo-logger-console")(true, true, true, true));
If you wish to log to syslog just:
npm install cinovo-logger-syslog
In your JavaScript code append the endpoint.
logger.append(require("cinovo-logger-syslog").local(true, true, true, true, "test", "local0"));
You could also log to file, AWS (S3, SQS, SNS), Mac OS X Notification Center or Loggly
logger.debug("all values are ok");
logger.info("myscript", "all values are ok");
logger.error("myscript", "some values are not ok", {a: 10, b: 20});
logger.exception("myscript", "some values are not ok", new Error("error"));
logger.critical("myscript", "all values are not ok", {a: 10, b: 20}, function(err) { ... });
Now you can log to multiple endpoints.
You are likely to use some other npms so we tried to integrate cinovo-logger with some popular npms by providing wrapprs:
Depending on the level you want to log choose one of the four methods.
origin
: String to indicate where the log come from, e. g. the name of the script (optional)message
: String to tell what happenedmetadata
: String, Number, Boolean, Array or Object to tell you more about the situation (optional)callback
: Function(err) Fired after log was processed by all endpoints (optional)
err
: Error (optional)Examples:
logger.debug("all values are ok");
logger.info("myscript", "all values are ok");
logger.error("myscript", "some values are not ok", {a: 10, b: 20});
logger.critical("myscript", "all values are not ok", {a: 10, b: 20}, function(err) { ... });
If you want to log an Error there is a special method exception
which logs as an error
origin
: String to indicate where the log come from, e. g. the name of the script (optional)message
: String to tell what happenederror
: Errorcallback
: Function(err) Fired after log was processed by all endpoints (optional)
err
: Error (optional)Examples:
logger.exception("some values are not ok", new Error("error"));
logger.exception("myscript", "some values are not ok", new Error("error"));
logger.exception("myscript", "some values are not ok", new Error("error"), function(err) { ... });
The log object contains the following fields:
{
level: String["debug", "info", "error", "critical"]
date: Date
pid: Number
hostname: String
origin: String to indicate where the log come from, e. g. the name of the script (optional)
message: String to tell what happened
metadata: String, Number, Boolean, Array or Object to tell you more about the situation (optional)
fullOrigin: {
file: String of the file name,
line: Number of the line,
fn: String of the invoked function name
} (optional)
}
The cinovo-logger is also an EventEmitter.
Adds a listener to the end of the listeners array for the specified event.
event
: Stringlistener
: Function - see Events for signatureAdds a one time listener for the event. This listener is invoked only the next time the level is fired, after which it is removed.
event
: Stringlistener
: Function - see Events for signatureRemove a listener from the listener array for the specified event.
event
: Stringlistener
: Function - see Events for signatureRemoves all listeners, or those of the specified event.
event
: String (optional)endpoint
: must extend Endpoint see Custom Endpointendpoint
: must extend Endpoint see Custom Endpointcallback
: Function(err)
err
: ErrorStop all endpoints to avoid data loss.
callback
: Function(err)
err
: ErrorActivates fullOrigin
output in log
. Locates the caller of an log function debug
, info
, error
, exception
, critical
by:
{
file: String of the file name,
line: Number of the line,
fn: String of the invoked function name
}
On debug
log.
log
: LogOn info
log.
log
: LogOn error
log.
log
: LogOn critical
log.
log
: LogIf you use on of the log methods debug
, info
, error
, exception
, critical
without the optional callback
and an Error occurs it is emitted.
err
: ErrorIf an endpoint.log() returned an error or an error was emitted by an endpoint.
endpoint
: Endpointerr
: ErrorFrom time to time it makes sense to have more than one logger instance.
var myLogger = require("cinovo-logger").createLogger();
myLogger.append(require("cinovo-logger-console")(true, true, true, true));
myLogger.debug("all values are ok");
You can configure the logger during creation or after creation.
during creation:
var cfg = {
fullOrigin: false,
filter: {
"*": true
}
};
var myLogger = require("cinovo-logger").createLogger(cfg);
after creation:
var logger = require("cinovo-logger");
// do something
logger.cfg.fullOrigin = true;
There are several options available:
Boolean
- Activates fullOrigin
output in log
. (default: false
)
Examples:
var cfg = {
fullOrigin: true
};
Object
- Allow or block log
from origin
and/or level
. (default: {"*": true}
)
Examples:
`````javascriptvar cfg = { filter: { "*": false, // block everything (required) "*/critical": true, // but allow critical
level "myorigin/*": true, // and allow everything from
originmyorigin "yourorigin/debug": true, // and allow everything from
originyourorigin and
level` debug
}
};
### Custom Endpoint
Visit [cinovo-logger-lib](https://github.com/cinovo/node-logger-lib).
FAQs
Async logger for Node.js with multiple endpoints.
The npm package cinovo-logger receives a total of 1 weekly downloads. As such, cinovo-logger popularity was classified as not popular.
We found that cinovo-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.