@strapi/logger
Advanced tools
Comparing version 0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71 to 0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81
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 |
@@ -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 |
@@ -1,2 +0,1 @@ | ||
declare const _default: import("logform").Format; | ||
/** | ||
@@ -6,2 +5,4 @@ * This will remove the chalk color codes from the message provided. | ||
*/ | ||
declare const _default: import("logform").Format; | ||
export default _default; | ||
//# sourceMappingURL=exclude-colors.d.ts.map |
@@ -1,3 +0,5 @@ | ||
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'; | ||
//# 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 |
@@ -12,3 +12,2 @@ import { Logform } from 'winston'; | ||
} | ||
declare const _default: (options?: PrettyPrintOptions) => Logform.Format; | ||
/** | ||
@@ -18,2 +17,4 @@ * Create a pretty print formatter for a winston logger | ||
*/ | ||
declare const _default: (options?: PrettyPrintOptions) => Logform.Format; | ||
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 |
"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]; } }; | ||
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" } }); | ||
if (e) { | ||
for (const k in e) { | ||
if (k !== "default") { | ||
const d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: () => e[k] | ||
}); | ||
} | ||
} | ||
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; | ||
} | ||
n.default = e; | ||
return Object.freeze(n); | ||
} | ||
const winston__namespace = /* @__PURE__ */ _interopNamespace(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 ? ` | ||
${info.stack}` : ""}` }; | ||
} | ||
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; | ||
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); | ||
}; | ||
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 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 index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__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, fileTransportOptions = {}) => { | ||
return { | ||
level: LEVEL_LABEL, | ||
levels: LEVELS, | ||
format: prettyPrint(), | ||
transports: [ | ||
new winston.transports.Console(), | ||
new winston.transports.File({ | ||
level: "error", | ||
filename, | ||
format: excludeColors, | ||
...fileTransportOptions | ||
}) | ||
] | ||
}; | ||
}; | ||
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
createDefaultConfiguration: defaultConfiguration, | ||
createOutputFileConfiguration: outputFileConfiguration | ||
}, Symbol.toStringTag, { value: "Module" })); | ||
const createLogger = (userConfiguration = {}) => { | ||
const configuration = configs.createDefaultConfiguration(); | ||
Object.assign(configuration, userConfiguration); | ||
return winston.createLogger(configuration); | ||
const configuration = defaultConfiguration(); | ||
Object.assign(configuration, userConfiguration); | ||
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-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71", | ||
"version": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81", | ||
"description": "Strapi's logger", | ||
@@ -27,27 +27,29 @@ "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": "pack-up build", | ||
"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": "pack-up watch" | ||
}, | ||
"dependencies": { | ||
"lodash": "4.17.21", | ||
"winston": "3.3.3" | ||
"winston": "3.10.0" | ||
}, | ||
"devDependencies": { | ||
"eslint-config-custom": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71", | ||
"tsconfig": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71" | ||
"@strapi/pack-up": "5.0.0", | ||
"eslint-config-custom": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81", | ||
"tsconfig": "0.0.0-next.f4ec69568d980c6fee91ce2ee0f41c138347aa81" | ||
}, | ||
"engines": { | ||
"node": ">=14.19.1 <=18.x.x", | ||
"node": ">=18.0.0 <=22.x.x", | ||
"npm": ">=6.0.0" | ||
}, | ||
"gitHead": "f45143c5e2a8a9d85691d0abf79a3f42024a0c71" | ||
"gitHead": "f4ec69568d980c6fee91ce2ee0f41c138347aa81" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27123
257
3
26
1
80
1
+ Added@colors/colors@1.5.0(transitive)
+ Addedwinston@3.10.0(transitive)
- Removedwinston@3.3.3(transitive)
Updatedwinston@3.10.0