Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
molindo-node-logger
Advanced tools
A node.js logger that integrates well with the Molindo infrastructure.
A Node.js logger that integrates well with the Molindo infrastructure.
stderr
, while all other levels are printed to stdout
.unhandledRejection
errors thrown from promises are logged as well.operationName
in the case of GraphQL requests. Confidential headers like cookie
or authorization
are masked.ERROR
(40000), WARN
(30000), INFO
(20000), DEBUG
(10000), TRACE
(5000).import Logger from 'molindo-node-logger';
const logger = new Logger({ service: 'pizza-shop' });
logger.trace('Making a salami pizza …');
logger.debug('Adding salami …');
logger.info('Putting it in the oven …');
logger.warn("Don't forget to get it out in time …");
logger.error('Oh no, the pizza is burned!');
In production, printed JSON will look like this (except that it's not pretty printed):
{
"service": "pizza-shop",
"@timestamp": "2017-10-19T08:26:13.168Z",
"level": "INFO",
"level_value": 20000,
"message": "Pizza is ready!"
}
If you're running an express server, you can register the logger middleware to
log HTTP requests. GraphQL requests get automatically detected and attached as
meta.graphql
, with properties operationName
and the respective variables
.
import express from 'express';
import Logger, { createLoggerMiddleware } from 'molindo-node-logger';
const server = express();
const logger = new Logger({ service: 'pizza-shop' });
server.use(createLoggerMiddleware({ logger }));
The size of meta.graphql.variables
can sometimes grow too large to log
effectively. To manage this, the createLoggerMiddleware()
function provides a configurable parameter:
maxGraphQLVariablesLength
.
maxGraphQLVariablesLength
maxGraphQLVariablesLength
(default: 512), to set the maximum size of the meta.graphql.variables
payload to be logged.maxGraphQLVariablesLength
to 0
to completely turn off logging for meta.graphql.variables
.maxGraphQLVariablesLength
to -1
to include the complete meta.graphql.variables
payload without size restrictions.3.0.0
Limit the size of logged variables
for meta.graphql
in the middleware logger
via maxGraphQLVariablesLength
. It's possible that variables
is a big object that could bloat the payload.
maxGraphQLVariablesLength
is 512
, which causes meta.graphql.variables
to be truncated after 512
characters by default.FAQs
A node.js logger that integrates well with the Molindo infrastructure.
We found that molindo-node-logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.