
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
winston-console-format
Advanced tools
Winston@3 console formatter for debugging purposes using util.inspect().
Winston@3 console formatter for debugging purposes using util.inspect().
npm install winston-console-format
import { createLogger, format, transports } from "winston";
import { consoleFormat } from "winston-console-format";
import util from "util";
const logger = createLogger({
level: "silly",
format: format.combine(
format.timestamp(),
format.ms(),
format.errors({ stack: true }),
format.splat(),
format.json()
),
defaultMeta: { service: "Test" },
transports: [
new transports.Console({
format: format.combine(
format.colorize({ all: true }),
format.padLevels(),
consoleFormat({
showMeta: true,
metaStrip: ["timestamp", "service"],
inspectOptions: {
depth: Infinity,
colors: true,
maxArrayLength: Infinity,
breakLength: 120,
compact: Infinity,
},
})
),
}),
],
});
logger.silly("Logging initialized");
logger.debug("Debug an object", { make: "Ford", model: "Mustang", year: 1969 });
logger.verbose("Returned value", { value: util.format });
logger.info("Information", {
options: ["Lorem ipsum", "dolor sit amet"],
values: ["Donec augue eros, ultrices."],
});
logger.warn("Warning");
logger.error(new Error("Unexpected error"));
const { createLogger, format, transports } = require("winston");
const { consoleFormat } = require("winston-console-format");
const util = require("util");
const logger = createLogger({
level: "silly",
format: format.combine(
format.timestamp(),
format.ms(),
format.errors({ stack: true }),
format.splat(),
format.json()
),
defaultMeta: { service: "Test" },
transports: [
new transports.Console({
format: format.combine(
format.colorize({ all: true }),
format.padLevels(),
consoleFormat({
showMeta: true,
metaStrip: ["timestamp", "service"],
inspectOptions: {
depth: Infinity,
colors: true,
maxArrayLength: Infinity,
breakLength: 120,
compact: Infinity,
},
})
),
}),
],
});
logger.silly("Logging initialized");
logger.debug("Debug an object", { make: "Ford", model: "Mustang", year: 1969 });
logger.verbose("Returned value", { value: util.format });
logger.info("Information", {
options: ["Lorem ipsum", "dolor sit amet"],
values: ["Donec augue eros, ultrices."],
});
logger.warn("Warning");
logger.error(new Error("Unexpected error"));
Configuration object.
Type: ConsoleFormatOptions
Show/hide meta object(s).
Type: boolean
Default: true
Array of meta-object properties to hide.
Type: string[]
Default: []
util.inspect()
configuration object.
Type: Object
Default: Node util.inspect(object[, options])
v1.0.8
FAQs
Winston@3 console formatter for debugging purposes using util.inspect().
The npm package winston-console-format receives a total of 47,802 weekly downloads. As such, winston-console-format popularity was classified as popular.
We found that winston-console-format 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
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.