Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ecs-logs-js
Advanced tools
Basic usage
var log = require('ecs-logs-js');
log.debug('debug message, not logged if NODE_ENV=production');
log.info('Hi there!');
The Logger type is a winston logger with preconfigured defaults to output log messages compatible with ecs-logs.
Creating and using a Logger
var ecslogs = require('ecs-logs-js');
var log = new ecslogs.Logger({
level: 'info'
});
log.info('Hi there!');
The Transport type implements a winston log transport preconfigured to output log messages compatible with ecs-logs.
Creating and using a Transport in a winston logger
var ecslogs = require('ecs-logs-js');
var winston = require('winston');
// Instantiate an ecs-logs compatible winston logger with ecslogs.Transport
var logger = new winston.Logger({
transports: [
new ecslogs.Transport()
]
});
The Formatter type implements a winston log formatter that produces messages compatible with ecs-logs.
The object returned when instantiating the Formatter type is callable. When called, it expects a log entry object.
When a formatter instance is called it accepts a log entry as argument and returns a JSON representation of the entry in a format compatible with ecs-logs.
Creating and using a Formatter in a winston logger
var ecslogs = require('ecs-logs-js');
var winston = require('winston');
// Instantiate an ecs-logs compatible winston logger with ecslogs.Formatter
var logger = new winston.Logger({
transports: [
new winston.transports.Console({
timestamp: Date.now,
formatter: new ecslogs.Formatter()
})
]
});
Using a Formatter to serialize log entries
var ecslogs = require('ecs-logs-js');
var formatter = new ecslogs.Formatter();
// Returns a serialized log message compatible with ecs-logs.
var s = formatter({
message: 'the log message',
level: 'info',
meta: {
'User-Agent': 'node'
}
});
FAQs
Simple Node.js console logger that outputs human friendly and ecs-logs compatible messages
The npm package ecs-logs-js receives a total of 2,068 weekly downloads. As such, ecs-logs-js popularity was classified as popular.
We found that ecs-logs-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 300 open source maintainers 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 uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.