New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@strapi/logger

Package Overview
Dependencies
Maintainers
0
Versions
1561
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@strapi/logger - npm Package Compare versions

Comparing version 0.0.0-experimental.6e4965146398480201de1e5fa870efbead50da6a to 0.0.0-experimental.6ebd52456403cda71628e275f67617905f411af4

dist/formats/detailed-log.d.ts

4

dist/configs/output-file-configuration.d.ts

@@ -1,4 +0,4 @@

import { LoggerOptions } from 'winston';
declare const _default: (filename: string) => LoggerOptions;
import { transports, LoggerOptions } from 'winston';
declare const _default: (filename: string, fileTransportOptions?: transports.FileTransportOptions) => LoggerOptions;
export default _default;
//# sourceMappingURL=output-file-configuration.d.ts.map

@@ -5,2 +5,3 @@ export { default as prettyPrint } from './pretty-print';

export { default as excludeColors } from './exclude-colors';
export { default as detailedLogs } from './detailed-log';
//# sourceMappingURL=index.d.ts.map

@@ -1,18 +0,17 @@

"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const winston = require("winston");
function _interopNamespace(e) {
if (e && e.__esModule)
return e;
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
'use strict';
var winston = require('winston');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
for (const k in e) {
if (k !== "default") {
const d = Object.getOwnPropertyDescriptor(e, k);
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: () => e[k]
get: function () { return e[k]; }
});
}
}
});
}

@@ -22,83 +21,116 @@ n.default = e;

}
const winston__namespace = /* @__PURE__ */ _interopNamespace(winston);
var winston__namespace = /*#__PURE__*/_interopNamespaceDefault(winston);
const LEVELS = winston.config.npm.levels;
const LEVEL_LABEL = "silly";
const LEVEL_LABEL = 'silly';
LEVELS[LEVEL_LABEL];
const logErrors = winston.format((info) => {
if (info instanceof Error) {
return { ...info, message: `${info.message}${info.stack ? `
${info.stack}` : ""}` };
}
return info;
const logErrors = winston.format((info)=>{
if (info instanceof Error) {
return {
...info,
message: `${info.message}${info.stack ? `\n${info.stack}` : ''}`
};
}
return info;
});
const defaultTimestampFormat = "YYYY-MM-DD HH:mm:ss.SSS";
const prettyPrint = (options = {}) => {
const { timestamps = true, colors = true } = options;
const handlers = [];
if (timestamps) {
handlers.push(
winston.format.timestamp({
format: timestamps === true ? defaultTimestampFormat : timestamps
})
);
}
if (colors) {
handlers.push(winston.format.colorize());
}
handlers.push(logErrors());
handlers.push(
winston.format.printf(({ level, message, timestamp }) => {
return `${timestamps ? `[${timestamp}] ` : ""}${level}: ${message}`;
})
);
return winston.format.combine(...handlers);
};
const levelFilter = (...levels) => {
return winston.format((info) => levels.some((level) => info.level.includes(level)) ? info : false)();
};
const excludeColors = winston.format.printf(({ message }) => {
if (typeof message !== "string") {
return message;
}
return message.replace(
// eslint-disable-next-line no-control-regex
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
""
);
const defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';
/**
* Create a pretty print formatter for a winston logger
* @param options
*/ var prettyPrint = ((options = {})=>{
const { timestamps = true, colors = true } = options;
const handlers = [];
if (timestamps) {
handlers.push(winston.format.timestamp({
format: timestamps === true ? defaultTimestampFormat : timestamps
}));
}
if (colors) {
handlers.push(winston.format.colorize());
}
handlers.push(logErrors());
handlers.push(winston.format.printf(({ level, message, timestamp })=>{
return `${timestamps ? `[${timestamp}] ` : ''}${level}: ${message}`;
}));
return winston.format.combine(...handlers);
});
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
var levelFilter = ((...levels)=>{
return winston.format((info)=>levels.some((level)=>info.level.includes(level)) ? info : false)();
});
/**
* This will remove the chalk color codes from the message provided.
* It's used to log plain text in the log file
*/ var excludeColors = winston.format.printf(({ message })=>{
if (typeof message !== 'string') {
return message;
}
return message.replace(// eslint-disable-next-line no-control-regex
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
});
/**
* This will remove the chalk color codes from the message provided.
* It's used to log plain text in the log file
*/ var detailedLog = winston.format.printf(({ message, level, timestamp })=>{
if (typeof message !== 'string') {
return message;
}
const newMessage = `[${timestamp}] ${level}: ${message}`;
return newMessage.replace(// eslint-disable-next-line no-control-regex
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
});
var index$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
excludeColors,
levelFilter,
prettyPrint
}, Symbol.toStringTag, { value: "Module" }));
const defaultConfiguration = () => {
return {
level: LEVEL_LABEL,
levels: LEVELS,
format: prettyPrint(),
transports: [new winston.transports.Console()]
};
};
const outputFileConfiguration = (filename) => {
return {
level: LEVEL_LABEL,
levels: LEVELS,
format: prettyPrint(),
transports: [
new winston.transports.Console(),
new winston.transports.File({ level: "error", filename, format: excludeColors })
]
};
};
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
detailedLogs: detailedLog,
excludeColors: excludeColors,
levelFilter: levelFilter,
prettyPrint: prettyPrint
});
var defaultConfiguration = (()=>{
return {
level: LEVEL_LABEL,
levels: LEVELS,
format: prettyPrint(),
transports: [
new winston.transports.Console()
]
};
});
var outputFileConfiguration = ((filename, fileTransportOptions = {})=>{
return {
level: LEVEL_LABEL,
levels: LEVELS,
format: prettyPrint(),
transports: [
new winston.transports.Console(),
new winston.transports.File({
level: 'error',
filename,
format: excludeColors,
...fileTransportOptions
})
]
};
});
var index = /*#__PURE__*/Object.freeze({
__proto__: null,
createDefaultConfiguration: defaultConfiguration,
createOutputFileConfiguration: outputFileConfiguration
}, Symbol.toStringTag, { value: "Module" }));
const createLogger = (userConfiguration = {}) => {
const configuration = defaultConfiguration();
Object.assign(configuration, userConfiguration);
return winston__namespace.createLogger(configuration);
});
const createLogger = (userConfiguration = {})=>{
const configuration = defaultConfiguration();
Object.assign(configuration, userConfiguration);
return winston__namespace.createLogger(configuration);
};
exports.winston = winston__namespace;

@@ -105,0 +137,0 @@ exports.configs = index;

{
"name": "@strapi/logger",
"version": "0.0.0-experimental.6e4965146398480201de1e5fa870efbead50da6a",
"version": "0.0.0-experimental.6ebd52456403cda71628e275f67617905f411af4",
"description": "Strapi's logger",

@@ -31,10 +31,12 @@ "homepage": "https://strapi.io",

"files": [
"./dist"
"dist/"
],
"scripts": {
"build": "pack-up build",
"build": "run -T npm-run-all clean --parallel build:code build:types",
"build:code": "run -T rollup -c",
"build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"test:ts": "run -T tsc --noEmit",
"watch": "pack-up watch"
"watch": "run -T rollup -c -w"
},

@@ -46,11 +48,9 @@ "dependencies": {

"devDependencies": {
"@strapi/pack-up": "4.23.0",
"eslint-config-custom": "0.0.0-experimental.6e4965146398480201de1e5fa870efbead50da6a",
"tsconfig": "0.0.0-experimental.6e4965146398480201de1e5fa870efbead50da6a"
"eslint-config-custom": "0.0.0-experimental.6ebd52456403cda71628e275f67617905f411af4",
"tsconfig": "0.0.0-experimental.6ebd52456403cda71628e275f67617905f411af4"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"gitHead": "6e4965146398480201de1e5fa870efbead50da6a"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc