
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
logwrangler
Advanced tools
logwrangler is a module logging system that you can easily extend to add various logging locations and functions.
npm install --save logwrangler
Logging to stdout
var logwrangler = require('../index');
var logger = logwrangler.create();
logger.log({
level: logger.levels.INFO,
ns: 'web server',
message: 'some log message',
data: {}
});
level <string>
Specifies the level of the log. Levels can be found in logwrangler
object or in the logger
instance object.
Available levels include:
DEBUG
INFO
WARN
ERROR
ns <string>
Specifies a particular namespace for your log. Good for grouping logs by location in your codebase or by component.
node <string>
Name of the node, machine, or specific process currently running.
ident <string>
A more local identifier for the particular log. This could be something like a user ID to make it easy to trace the actions of a user.
message <string>
A human readable message to describe what is happening
data <object>
Contextual data related to the this particular log message. If the value of data
is an Error()
, the error will be parsed to grab it's message and stack trace and data
will be rewritten to have an error
property that will contain the contents of the Error
object.
data, no error
{
data: {
someKey: 'someValue'
}
}
data, with error
{
data: new Error('Some error message')
}
// will become:
{
data: {
error: {
message: 'Some error message',
stack: <stack trace>
}
}
}
data, error and context
{
data: {
error: new Error('Some error message'),
someKey: 'someValue'
}
}
// will become
{
data: {
error: {
message: 'Some error message',
stack: <stack trace>
},
someKey: 'someValue'
}
}
Creating a custom logger is as easy as providing an anonymous function to logger.use
.
options
Options that you passed in during initialization
{
options: {
level: <level to use>
}
}
data
The data to be logged
{
data: {
level: <log level>,
ns: <namespace - string>,
ident: <custom identifier - string>,
node: <node, machine, process, identifier - string>
message: <message - string>,
data: <custom data - object>
}
}
var logger = fancyLog.create({
level: fancyLog.levels.DEBUG, // default level to log
});
logger.use(function(options, data){
// do something with your data
});
FAQs
Wrangle up your logging
The npm package logwrangler receives a total of 0 weekly downloads. As such, logwrangler popularity was classified as not popular.
We found that logwrangler 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.