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
8
Versions
1571
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.3cadca87513eebfb388e8328d166fc3112020c51 to 0.0.0-experimental.3d525b3d2d44b055469a7694f6aaecfe7145b9e6

dist/configs/default-configuration.d.ts.map

1

dist/configs/default-configuration.d.ts
import { LoggerOptions } from 'winston';
declare const _default: () => LoggerOptions;
export default _default;
//# sourceMappingURL=default-configuration.d.ts.map
export { default as createDefaultConfiguration } from './default-configuration';
export { default as createOutputFileConfiguration } from './output-file-configuration';
//# sourceMappingURL=index.d.ts.map

5

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

@@ -1,3 +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

@@ -6,1 +6,2 @@ import { config } from 'winston';

export { LEVEL, LEVEL_LABEL, LEVELS };
//# sourceMappingURL=constants.d.ts.map

@@ -7,1 +7,2 @@ /**

export default _default;
//# sourceMappingURL=exclude-colors.d.ts.map

@@ -1,3 +0,6 @@

export { default as prettyPrint, PrettyPrintOptions } from './pretty-print';
export { default as prettyPrint } from './pretty-print';
export type { PrettyPrintOptions } from './pretty-print';
export { default as levelFilter } from './level-filter';
export { default as excludeColors } from './exclude-colors';
export { default as detailedLogs } from './detailed-log';
//# sourceMappingURL=index.d.ts.map
declare const _default: (...levels: string[]) => import("logform").Format;
export default _default;
//# sourceMappingURL=level-filter.d.ts.map
import { Logform } from 'winston';
declare const logErrors: Logform.FormatWrap;
export default logErrors;
//# sourceMappingURL=log-errors.d.ts.map

@@ -18,1 +18,2 @@ import { Logform } from 'winston';

export default _default;
//# sourceMappingURL=pretty-print.d.ts.map
import * as winston from 'winston';
import * as configs from './configs';
export * as formats from './formats';
export type Logger = winston.Logger;
declare const createLogger: (userConfiguration?: winston.LoggerOptions) => winston.Logger;
export { createLogger, winston, configs };
//# sourceMappingURL=index.d.ts.map

@@ -1,38 +0,139 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
'use strict';
var winston = require('winston');
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
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: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var winston__namespace = /*#__PURE__*/_interopNamespaceDefault(winston);
const LEVELS = winston.config.npm.levels;
const LEVEL_LABEL = 'silly';
LEVELS[LEVEL_LABEL];
const logErrors = winston.format((info)=>{
if (info instanceof Error) {
return {
...info,
message: `${info.message}${info.stack ? `\n${info.stack}` : ''}`
};
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
return info;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.configs = exports.winston = exports.createLogger = exports.formats = void 0;
const winston = __importStar(require("winston"));
exports.winston = winston;
const configs = __importStar(require("./configs"));
exports.configs = configs;
exports.formats = __importStar(require("./formats"));
const createLogger = (userConfiguration = {}) => {
const configuration = configs.createDefaultConfiguration();
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);
});
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,
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
});
const createLogger = (userConfiguration = {})=>{
const configuration = defaultConfiguration();
Object.assign(configuration, userConfiguration);
return winston.createLogger(configuration);
return winston__namespace.createLogger(configuration);
};
exports.winston = winston__namespace;
exports.configs = index;
exports.createLogger = createLogger;
//# sourceMappingURL=index.js.map
exports.formats = index$1;
//# sourceMappingURL=index.js.map
{
"name": "@strapi/logger",
"version": "0.0.0-experimental.3cadca87513eebfb388e8328d166fc3112020c51",
"version": "0.0.0-experimental.3d525b3d2d44b055469a7694f6aaecfe7145b9e6",
"description": "Strapi's logger",

@@ -27,13 +27,16 @@ "homepage": "https://strapi.io",

"main": "./dist/index.js",
"module": "./dist/index.mjs",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"./dist"
"dist/"
],
"scripts": {
"build": "run -T tsc",
"build:ts": "run -T tsc",
"watch": "run -T tsc -w --preserveWatchOutput",
"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",
"prepublishOnly": "yarn clean && yarn build",
"lint": "run -T eslint ."
"lint": "run -T eslint .",
"test:ts": "run -T tsc --noEmit",
"watch": "run -T rollup -c -w"
},

@@ -45,10 +48,9 @@ "dependencies": {

"devDependencies": {
"eslint-config-custom": "0.0.0-experimental.3cadca87513eebfb388e8328d166fc3112020c51",
"tsconfig": "0.0.0-experimental.3cadca87513eebfb388e8328d166fc3112020c51"
"eslint-config-custom": "0.0.0-experimental.3d525b3d2d44b055469a7694f6aaecfe7145b9e6",
"tsconfig": "0.0.0-experimental.3d525b3d2d44b055469a7694f6aaecfe7145b9e6"
},
"engines": {
"node": ">=16.0.0 <=20.x.x",
"node": ">=18.0.0 <=22.x.x",
"npm": ">=6.0.0"
},
"gitHead": "3cadca87513eebfb388e8328d166fc3112020c51"
}
}

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