Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
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 698 weekly downloads. As such, ecs-logs-js popularity was classified as not 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.