Initial commit - Event Planner application
This commit is contained in:
202
node_modules/@nestjs/common/services/console-logger.service.d.ts
generated
vendored
Normal file
202
node_modules/@nestjs/common/services/console-logger.service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
import { InspectOptions } from 'util';
|
||||
import { LoggerService, LogLevel } from './logger.service';
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ConsoleLoggerOptions {
|
||||
/**
|
||||
* Enabled log levels.
|
||||
*/
|
||||
logLevels?: LogLevel[];
|
||||
/**
|
||||
* If enabled, will print timestamp (time difference) between current and previous log message.
|
||||
* Note: This option is not used when `json` is enabled.
|
||||
*/
|
||||
timestamp?: boolean;
|
||||
/**
|
||||
* A prefix to be used for each log message.
|
||||
* Note: This option is not used when `json` is enabled.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* If enabled, will print the log message in JSON format.
|
||||
*/
|
||||
json?: boolean;
|
||||
/**
|
||||
* If enabled, will print the log message in color.
|
||||
* Default true if json is disabled, false otherwise
|
||||
*/
|
||||
colors?: boolean;
|
||||
/**
|
||||
* The context of the logger.
|
||||
*/
|
||||
context?: string;
|
||||
/**
|
||||
* If enabled, will force the use of console.log/console.error instead of process.stdout/stderr.write.
|
||||
* This is useful for test environments like Jest that can buffer console calls.
|
||||
* @default false
|
||||
*/
|
||||
forceConsole?: boolean;
|
||||
/**
|
||||
* If enabled, will print the log message in a single line, even if it is an object with multiple properties.
|
||||
* If set to a number, the most n inner elements are united on a single line as long as all properties fit into breakLength. Short array elements are also grouped together.
|
||||
* Default true when `json` is enabled, false otherwise.
|
||||
*/
|
||||
compact?: boolean | number;
|
||||
/**
|
||||
* Specifies the maximum number of Array, TypedArray, Map, Set, WeakMap, and WeakSet elements to include when formatting.
|
||||
* Set to null or Infinity to show all elements. Set to 0 or negative to show no elements.
|
||||
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
||||
* @default 100
|
||||
*/
|
||||
maxArrayLength?: number;
|
||||
/**
|
||||
* Specifies the maximum number of characters to include when formatting.
|
||||
* Set to null or Infinity to show all elements. Set to 0 or negative to show no characters.
|
||||
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
||||
* @default 10000.
|
||||
*/
|
||||
maxStringLength?: number;
|
||||
/**
|
||||
* If enabled, will sort keys while formatting objects.
|
||||
* Can also be a custom sorting function.
|
||||
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
||||
* @default false
|
||||
*/
|
||||
sorted?: boolean | ((a: string, b: string) => number);
|
||||
/**
|
||||
* Specifies the number of times to recurse while formatting object.
|
||||
* This is useful for inspecting large objects. To recurse up to the maximum call stack size pass Infinity or null.
|
||||
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
||||
* @default 5
|
||||
*/
|
||||
depth?: number;
|
||||
/**
|
||||
* If true, object's non-enumerable symbols and properties are included in the formatted result.
|
||||
* WeakMap and WeakSet entries are also included as well as user defined prototype properties
|
||||
* @default false
|
||||
*/
|
||||
showHidden?: boolean;
|
||||
/**
|
||||
* The length at which input values are split across multiple lines. Set to Infinity to format the input as a single line (in combination with "compact" set to true).
|
||||
* Default Infinity when "compact" is true, 80 otherwise.
|
||||
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
||||
*/
|
||||
breakLength?: number;
|
||||
}
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export declare class ConsoleLogger implements LoggerService {
|
||||
/**
|
||||
* The options of the logger.
|
||||
*/
|
||||
protected options: ConsoleLoggerOptions;
|
||||
/**
|
||||
* The context of the logger (can be set manually or automatically inferred).
|
||||
*/
|
||||
protected context?: string;
|
||||
/**
|
||||
* The original context of the logger (set in the constructor).
|
||||
*/
|
||||
protected originalContext?: string;
|
||||
/**
|
||||
* The options used for the "inspect" method.
|
||||
*/
|
||||
protected inspectOptions: InspectOptions;
|
||||
/**
|
||||
* The last timestamp at which the log message was printed.
|
||||
*/
|
||||
protected static lastTimestampAt?: number;
|
||||
constructor();
|
||||
constructor(context: string);
|
||||
constructor(options: ConsoleLoggerOptions);
|
||||
constructor(context: string, options: ConsoleLoggerOptions);
|
||||
/**
|
||||
* Write a 'log' level log, if the configured level allows for it.
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
log(message: any, context?: string): void;
|
||||
log(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write an 'error' level log, if the configured level allows for it.
|
||||
* Prints to `stderr` with newline.
|
||||
*/
|
||||
error(message: any, stackOrContext?: string): void;
|
||||
error(message: any, stack?: string, context?: string): void;
|
||||
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
||||
/**
|
||||
* Write a 'warn' level log, if the configured level allows for it.
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
warn(message: any, context?: string): void;
|
||||
warn(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'debug' level log, if the configured level allows for it.
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
debug(message: any, context?: string): void;
|
||||
debug(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'verbose' level log, if the configured level allows for it.
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
verbose(message: any, context?: string): void;
|
||||
verbose(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'fatal' level log, if the configured level allows for it.
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
fatal(message: any, context?: string): void;
|
||||
fatal(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Set log levels
|
||||
* @param levels log levels
|
||||
*/
|
||||
setLogLevels(levels: LogLevel[]): void;
|
||||
/**
|
||||
* Set logger context
|
||||
* @param context context
|
||||
*/
|
||||
setContext(context: string): void;
|
||||
/**
|
||||
* Resets the logger context to the value that was passed in the constructor.
|
||||
*/
|
||||
resetContext(): void;
|
||||
isLevelEnabled(level: LogLevel): boolean;
|
||||
protected getTimestamp(): string;
|
||||
protected printMessages(messages: unknown[], context?: string, logLevel?: LogLevel, writeStreamType?: 'stdout' | 'stderr', errorStack?: unknown): void;
|
||||
protected printAsJson(message: unknown, options: {
|
||||
context: string;
|
||||
logLevel: LogLevel;
|
||||
writeStreamType?: 'stdout' | 'stderr';
|
||||
errorStack?: unknown;
|
||||
}): void;
|
||||
protected getJsonLogObject(message: unknown, options: {
|
||||
context: string;
|
||||
logLevel: LogLevel;
|
||||
writeStreamType?: 'stdout' | 'stderr';
|
||||
errorStack?: unknown;
|
||||
}): {
|
||||
level: LogLevel;
|
||||
pid: number;
|
||||
timestamp: number;
|
||||
message: unknown;
|
||||
context?: string;
|
||||
stack?: unknown;
|
||||
};
|
||||
protected formatPid(pid: number): string;
|
||||
protected formatContext(context: string): string;
|
||||
protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string): string;
|
||||
protected stringifyMessage(message: unknown, logLevel: LogLevel): any;
|
||||
protected colorize(message: string, logLevel: LogLevel): string;
|
||||
protected printStackTrace(stack: string): void;
|
||||
protected updateAndGetTimestampDiff(): string;
|
||||
protected formatTimestampDiff(timestampDiff: number): string;
|
||||
protected getInspectOptions(): InspectOptions;
|
||||
protected stringifyReplacer(key: string, value: unknown): unknown;
|
||||
private getContextAndMessagesToPrint;
|
||||
private getContextAndStackAndMessagesToPrint;
|
||||
private isStackFormat;
|
||||
private getColorByLogLevel;
|
||||
}
|
||||
379
node_modules/@nestjs/common/services/console-logger.service.js
generated
vendored
Normal file
379
node_modules/@nestjs/common/services/console-logger.service.js
generated
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
"use strict";
|
||||
var ConsoleLogger_1;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ConsoleLogger = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const util_1 = require("util");
|
||||
const core_1 = require("../decorators/core");
|
||||
const cli_colors_util_1 = require("../utils/cli-colors.util");
|
||||
const shared_utils_1 = require("../utils/shared.utils");
|
||||
const is_log_level_enabled_util_1 = require("./utils/is-log-level-enabled.util");
|
||||
const DEFAULT_DEPTH = 5;
|
||||
const DEFAULT_LOG_LEVELS = [
|
||||
'log',
|
||||
'error',
|
||||
'warn',
|
||||
'debug',
|
||||
'verbose',
|
||||
'fatal',
|
||||
];
|
||||
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
||||
year: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
second: 'numeric',
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
});
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
||||
constructor(contextOrOptions, options) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let [context, opts] = (0, shared_utils_1.isString)(contextOrOptions)
|
||||
? [contextOrOptions, options]
|
||||
: options
|
||||
? [undefined, options]
|
||||
: [contextOrOptions?.context, contextOrOptions];
|
||||
opts = opts ?? {};
|
||||
opts.logLevels ??= DEFAULT_LOG_LEVELS;
|
||||
opts.colors ??= opts.colors ?? (opts.json ? false : (0, cli_colors_util_1.isColorAllowed)());
|
||||
opts.prefix ??= 'Nest';
|
||||
this.options = opts;
|
||||
this.inspectOptions = this.getInspectOptions();
|
||||
if (context) {
|
||||
this.context = context;
|
||||
this.originalContext = context;
|
||||
}
|
||||
}
|
||||
log(message, ...optionalParams) {
|
||||
if (!this.isLevelEnabled('log')) {
|
||||
return;
|
||||
}
|
||||
const { messages, context } = this.getContextAndMessagesToPrint([
|
||||
message,
|
||||
...optionalParams,
|
||||
]);
|
||||
this.printMessages(messages, context, 'log');
|
||||
}
|
||||
error(message, ...optionalParams) {
|
||||
if (!this.isLevelEnabled('error')) {
|
||||
return;
|
||||
}
|
||||
const { messages, context, stack } = this.getContextAndStackAndMessagesToPrint([message, ...optionalParams]);
|
||||
this.printMessages(messages, context, 'error', 'stderr', stack);
|
||||
this.printStackTrace(stack);
|
||||
}
|
||||
warn(message, ...optionalParams) {
|
||||
if (!this.isLevelEnabled('warn')) {
|
||||
return;
|
||||
}
|
||||
const { messages, context } = this.getContextAndMessagesToPrint([
|
||||
message,
|
||||
...optionalParams,
|
||||
]);
|
||||
this.printMessages(messages, context, 'warn');
|
||||
}
|
||||
debug(message, ...optionalParams) {
|
||||
if (!this.isLevelEnabled('debug')) {
|
||||
return;
|
||||
}
|
||||
const { messages, context } = this.getContextAndMessagesToPrint([
|
||||
message,
|
||||
...optionalParams,
|
||||
]);
|
||||
this.printMessages(messages, context, 'debug');
|
||||
}
|
||||
verbose(message, ...optionalParams) {
|
||||
if (!this.isLevelEnabled('verbose')) {
|
||||
return;
|
||||
}
|
||||
const { messages, context } = this.getContextAndMessagesToPrint([
|
||||
message,
|
||||
...optionalParams,
|
||||
]);
|
||||
this.printMessages(messages, context, 'verbose');
|
||||
}
|
||||
fatal(message, ...optionalParams) {
|
||||
if (!this.isLevelEnabled('fatal')) {
|
||||
return;
|
||||
}
|
||||
const { messages, context } = this.getContextAndMessagesToPrint([
|
||||
message,
|
||||
...optionalParams,
|
||||
]);
|
||||
this.printMessages(messages, context, 'fatal');
|
||||
}
|
||||
/**
|
||||
* Set log levels
|
||||
* @param levels log levels
|
||||
*/
|
||||
setLogLevels(levels) {
|
||||
if (!this.options) {
|
||||
this.options = {};
|
||||
}
|
||||
this.options.logLevels = levels;
|
||||
}
|
||||
/**
|
||||
* Set logger context
|
||||
* @param context context
|
||||
*/
|
||||
setContext(context) {
|
||||
this.context = context;
|
||||
}
|
||||
/**
|
||||
* Resets the logger context to the value that was passed in the constructor.
|
||||
*/
|
||||
resetContext() {
|
||||
this.context = this.originalContext;
|
||||
}
|
||||
isLevelEnabled(level) {
|
||||
const logLevels = this.options?.logLevels;
|
||||
return (0, is_log_level_enabled_util_1.isLogLevelEnabled)(level, logLevels);
|
||||
}
|
||||
getTimestamp() {
|
||||
return dateTimeFormatter.format(Date.now());
|
||||
}
|
||||
printMessages(messages, context = '', logLevel = 'log', writeStreamType, errorStack) {
|
||||
messages.forEach(message => {
|
||||
if (this.options.json) {
|
||||
this.printAsJson(message, {
|
||||
context,
|
||||
logLevel,
|
||||
writeStreamType,
|
||||
errorStack,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const pidMessage = this.formatPid(process.pid);
|
||||
const contextMessage = this.formatContext(context);
|
||||
const timestampDiff = this.updateAndGetTimestampDiff();
|
||||
const formattedLogLevel = logLevel.toUpperCase().padStart(7, ' ');
|
||||
const formattedMessage = this.formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff);
|
||||
if (this.options.forceConsole) {
|
||||
if (writeStreamType === 'stderr') {
|
||||
console.error(formattedMessage.trim());
|
||||
}
|
||||
else {
|
||||
console.log(formattedMessage.trim());
|
||||
}
|
||||
}
|
||||
else {
|
||||
process[writeStreamType ?? 'stdout'].write(formattedMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
printAsJson(message, options) {
|
||||
const logObject = this.getJsonLogObject(message, options);
|
||||
const formattedMessage = !this.options.colors && this.inspectOptions.compact === true
|
||||
? JSON.stringify(logObject, this.stringifyReplacer)
|
||||
: (0, util_1.inspect)(logObject, this.inspectOptions);
|
||||
if (this.options.forceConsole) {
|
||||
if (options.writeStreamType === 'stderr') {
|
||||
console.error(formattedMessage);
|
||||
}
|
||||
else {
|
||||
console.log(formattedMessage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
process[options.writeStreamType ?? 'stdout'].write(`${formattedMessage}\n`);
|
||||
}
|
||||
}
|
||||
getJsonLogObject(message, options) {
|
||||
const logObject = {
|
||||
level: options.logLevel,
|
||||
pid: process.pid,
|
||||
timestamp: Date.now(),
|
||||
message,
|
||||
};
|
||||
if (options.context) {
|
||||
logObject.context = options.context;
|
||||
}
|
||||
if (options.errorStack) {
|
||||
logObject.stack = options.errorStack;
|
||||
}
|
||||
return logObject;
|
||||
}
|
||||
formatPid(pid) {
|
||||
return `[${this.options.prefix}] ${pid} - `;
|
||||
}
|
||||
formatContext(context) {
|
||||
if (!context) {
|
||||
return '';
|
||||
}
|
||||
context = `[${context}] `;
|
||||
return this.options.colors ? (0, cli_colors_util_1.yellow)(context) : context;
|
||||
}
|
||||
formatMessage(logLevel, message, pidMessage, formattedLogLevel, contextMessage, timestampDiff) {
|
||||
const output = this.stringifyMessage(message, logLevel);
|
||||
pidMessage = this.colorize(pidMessage, logLevel);
|
||||
formattedLogLevel = this.colorize(formattedLogLevel, logLevel);
|
||||
return `${pidMessage}${this.getTimestamp()} ${formattedLogLevel} ${contextMessage}${output}${timestampDiff}\n`;
|
||||
}
|
||||
stringifyMessage(message, logLevel) {
|
||||
if ((0, shared_utils_1.isFunction)(message)) {
|
||||
const messageAsStr = Function.prototype.toString.call(message);
|
||||
const isClass = messageAsStr.startsWith('class ');
|
||||
if (isClass) {
|
||||
// If the message is a class, we will display the class name.
|
||||
return this.stringifyMessage(message.name, logLevel);
|
||||
}
|
||||
// If the message is a non-class function, call it and re-resolve its value.
|
||||
return this.stringifyMessage(message(), logLevel);
|
||||
}
|
||||
if (typeof message === 'string') {
|
||||
return this.colorize(message, logLevel);
|
||||
}
|
||||
const outputText = (0, util_1.inspect)(message, this.inspectOptions);
|
||||
if ((0, shared_utils_1.isPlainObject)(message)) {
|
||||
return `Object(${Object.keys(message).length}) ${outputText}`;
|
||||
}
|
||||
if (Array.isArray(message)) {
|
||||
return `Array(${message.length}) ${outputText}`;
|
||||
}
|
||||
return outputText;
|
||||
}
|
||||
colorize(message, logLevel) {
|
||||
if (!this.options.colors || this.options.json) {
|
||||
return message;
|
||||
}
|
||||
const color = this.getColorByLogLevel(logLevel);
|
||||
return color(message);
|
||||
}
|
||||
printStackTrace(stack) {
|
||||
if (!stack || this.options.json) {
|
||||
return;
|
||||
}
|
||||
if (this.options.forceConsole) {
|
||||
console.error(stack);
|
||||
}
|
||||
else {
|
||||
process.stderr.write(`${stack}\n`);
|
||||
}
|
||||
}
|
||||
updateAndGetTimestampDiff() {
|
||||
const includeTimestamp = ConsoleLogger_1.lastTimestampAt && this.options?.timestamp;
|
||||
const result = includeTimestamp
|
||||
? this.formatTimestampDiff(Date.now() - ConsoleLogger_1.lastTimestampAt)
|
||||
: '';
|
||||
ConsoleLogger_1.lastTimestampAt = Date.now();
|
||||
return result;
|
||||
}
|
||||
formatTimestampDiff(timestampDiff) {
|
||||
const formattedDiff = ` +${timestampDiff}ms`;
|
||||
return this.options.colors ? (0, cli_colors_util_1.yellow)(formattedDiff) : formattedDiff;
|
||||
}
|
||||
getInspectOptions() {
|
||||
let breakLength = this.options.breakLength;
|
||||
if (typeof breakLength === 'undefined') {
|
||||
breakLength = this.options.colors
|
||||
? this.options.compact
|
||||
? Infinity
|
||||
: undefined
|
||||
: this.options.compact === false
|
||||
? undefined
|
||||
: Infinity; // default breakLength to Infinity if inline is not set and colors is false
|
||||
}
|
||||
const inspectOptions = {
|
||||
depth: this.options.depth ?? DEFAULT_DEPTH,
|
||||
sorted: this.options.sorted,
|
||||
showHidden: this.options.showHidden,
|
||||
compact: this.options.compact ?? (this.options.json ? true : false),
|
||||
colors: this.options.colors,
|
||||
breakLength,
|
||||
};
|
||||
if (typeof this.options.maxArrayLength !== 'undefined') {
|
||||
inspectOptions.maxArrayLength = this.options.maxArrayLength;
|
||||
}
|
||||
if (typeof this.options.maxStringLength !== 'undefined') {
|
||||
inspectOptions.maxStringLength = this.options.maxStringLength;
|
||||
}
|
||||
return inspectOptions;
|
||||
}
|
||||
stringifyReplacer(key, value) {
|
||||
// Mimic util.inspect behavior for JSON logger with compact on and colors off
|
||||
if (typeof value === 'bigint') {
|
||||
return value.toString();
|
||||
}
|
||||
if (typeof value === 'symbol') {
|
||||
return value.toString();
|
||||
}
|
||||
if (value instanceof Map ||
|
||||
value instanceof Set ||
|
||||
value instanceof Error) {
|
||||
return `${(0, util_1.inspect)(value, this.inspectOptions)}`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
getContextAndMessagesToPrint(args) {
|
||||
if (args?.length <= 1) {
|
||||
return { messages: args, context: this.context };
|
||||
}
|
||||
const lastElement = args[args.length - 1];
|
||||
const isContext = (0, shared_utils_1.isString)(lastElement);
|
||||
if (!isContext) {
|
||||
return { messages: args, context: this.context };
|
||||
}
|
||||
return {
|
||||
context: lastElement,
|
||||
messages: args.slice(0, args.length - 1),
|
||||
};
|
||||
}
|
||||
getContextAndStackAndMessagesToPrint(args) {
|
||||
if (args.length === 2) {
|
||||
return this.isStackFormat(args[1])
|
||||
? {
|
||||
messages: [args[0]],
|
||||
stack: args[1],
|
||||
context: this.context,
|
||||
}
|
||||
: { ...this.getContextAndMessagesToPrint(args) };
|
||||
}
|
||||
const { messages, context } = this.getContextAndMessagesToPrint(args);
|
||||
if (messages?.length <= 1) {
|
||||
return { messages, context };
|
||||
}
|
||||
const lastElement = messages[messages.length - 1];
|
||||
const isStack = (0, shared_utils_1.isString)(lastElement);
|
||||
// https://github.com/nestjs/nest/issues/11074#issuecomment-1421680060
|
||||
if (!isStack && !(0, shared_utils_1.isUndefined)(lastElement)) {
|
||||
return { messages, context };
|
||||
}
|
||||
return {
|
||||
stack: lastElement,
|
||||
messages: messages.slice(0, messages.length - 1),
|
||||
context,
|
||||
};
|
||||
}
|
||||
isStackFormat(stack) {
|
||||
if (!(0, shared_utils_1.isString)(stack) && !(0, shared_utils_1.isUndefined)(stack)) {
|
||||
return false;
|
||||
}
|
||||
return /^(.)+\n\s+at .+:\d+:\d+/.test(stack);
|
||||
}
|
||||
getColorByLogLevel(level) {
|
||||
switch (level) {
|
||||
case 'debug':
|
||||
return cli_colors_util_1.clc.magentaBright;
|
||||
case 'warn':
|
||||
return cli_colors_util_1.clc.yellow;
|
||||
case 'error':
|
||||
return cli_colors_util_1.clc.red;
|
||||
case 'verbose':
|
||||
return cli_colors_util_1.clc.cyanBright;
|
||||
case 'fatal':
|
||||
return cli_colors_util_1.clc.bold;
|
||||
default:
|
||||
return cli_colors_util_1.clc.green;
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.ConsoleLogger = ConsoleLogger;
|
||||
exports.ConsoleLogger = ConsoleLogger = ConsoleLogger_1 = tslib_1.__decorate([
|
||||
(0, core_1.Injectable)(),
|
||||
tslib_1.__param(0, (0, core_1.Optional)()),
|
||||
tslib_1.__param(1, (0, core_1.Optional)()),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object])
|
||||
], ConsoleLogger);
|
||||
3
node_modules/@nestjs/common/services/index.d.ts
generated
vendored
Normal file
3
node_modules/@nestjs/common/services/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './console-logger.service';
|
||||
export * from './logger.service';
|
||||
export * from './utils/filter-log-levels.util';
|
||||
6
node_modules/@nestjs/common/services/index.js
generated
vendored
Normal file
6
node_modules/@nestjs/common/services/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./console-logger.service"), exports);
|
||||
tslib_1.__exportStar(require("./logger.service"), exports);
|
||||
tslib_1.__exportStar(require("./utils/filter-log-levels.util"), exports);
|
||||
152
node_modules/@nestjs/common/services/logger.service.d.ts
generated
vendored
Normal file
152
node_modules/@nestjs/common/services/logger.service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
export declare const LOG_LEVELS: ["verbose", "debug", "log", "warn", "error", "fatal"];
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export type LogLevel = (typeof LOG_LEVELS)[number];
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface LoggerService {
|
||||
/**
|
||||
* Write a 'log' level log.
|
||||
*/
|
||||
log(message: any, ...optionalParams: any[]): any;
|
||||
/**
|
||||
* Write an 'error' level log.
|
||||
*/
|
||||
error(message: any, ...optionalParams: any[]): any;
|
||||
/**
|
||||
* Write a 'warn' level log.
|
||||
*/
|
||||
warn(message: any, ...optionalParams: any[]): any;
|
||||
/**
|
||||
* Write a 'debug' level log.
|
||||
*/
|
||||
debug?(message: any, ...optionalParams: any[]): any;
|
||||
/**
|
||||
* Write a 'verbose' level log.
|
||||
*/
|
||||
verbose?(message: any, ...optionalParams: any[]): any;
|
||||
/**
|
||||
* Write a 'fatal' level log.
|
||||
*/
|
||||
fatal?(message: any, ...optionalParams: any[]): any;
|
||||
/**
|
||||
* Set log levels.
|
||||
* @param levels log levels
|
||||
*/
|
||||
setLogLevels?(levels: LogLevel[]): any;
|
||||
}
|
||||
interface LogBufferRecord {
|
||||
/**
|
||||
* Method to execute.
|
||||
*/
|
||||
methodRef: Function;
|
||||
/**
|
||||
* Arguments to pass to the method.
|
||||
*/
|
||||
arguments: unknown[];
|
||||
}
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export declare class Logger implements LoggerService {
|
||||
protected context?: string | undefined;
|
||||
protected options: {
|
||||
timestamp?: boolean;
|
||||
};
|
||||
protected static logBuffer: LogBufferRecord[];
|
||||
protected static staticInstanceRef?: LoggerService;
|
||||
protected static logLevels?: LogLevel[];
|
||||
private static isBufferAttached;
|
||||
protected localInstanceRef?: LoggerService;
|
||||
private static WrapBuffer;
|
||||
constructor();
|
||||
constructor(context: string);
|
||||
constructor(context: string, options?: {
|
||||
timestamp?: boolean;
|
||||
});
|
||||
get localInstance(): LoggerService;
|
||||
/**
|
||||
* Write an 'error' level log.
|
||||
*/
|
||||
error(message: any, stack?: string, context?: string): void;
|
||||
error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
||||
/**
|
||||
* Write a 'log' level log.
|
||||
*/
|
||||
log(message: any, context?: string): void;
|
||||
log(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'warn' level log.
|
||||
*/
|
||||
warn(message: any, context?: string): void;
|
||||
warn(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'debug' level log.
|
||||
*/
|
||||
debug(message: any, context?: string): void;
|
||||
debug(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'verbose' level log.
|
||||
*/
|
||||
verbose(message: any, context?: string): void;
|
||||
verbose(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'fatal' level log.
|
||||
*/
|
||||
fatal(message: any, context?: string): void;
|
||||
fatal(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write an 'error' level log.
|
||||
*/
|
||||
static error(message: any, stackOrContext?: string): void;
|
||||
static error(message: any, context?: string): void;
|
||||
static error(message: any, stack?: string, context?: string): void;
|
||||
static error(message: any, ...optionalParams: [...any, string?, string?]): void;
|
||||
/**
|
||||
* Write a 'log' level log.
|
||||
*/
|
||||
static log(message: any, context?: string): void;
|
||||
static log(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'warn' level log.
|
||||
*/
|
||||
static warn(message: any, context?: string): void;
|
||||
static warn(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'debug' level log, if the configured level allows for it.
|
||||
* Prints to `stdout` with newline.
|
||||
*/
|
||||
static debug(message: any, context?: string): void;
|
||||
static debug(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'verbose' level log.
|
||||
*/
|
||||
static verbose(message: any, context?: string): void;
|
||||
static verbose(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Write a 'fatal' level log.
|
||||
*/
|
||||
static fatal(message: any, context?: string): void;
|
||||
static fatal(message: any, ...optionalParams: [...any, string?]): void;
|
||||
/**
|
||||
* Print buffered logs and detach buffer.
|
||||
*/
|
||||
static flush(): void;
|
||||
/**
|
||||
* Attach buffer.
|
||||
* Turns on initialization logs buffering.
|
||||
*/
|
||||
static attachBuffer(): void;
|
||||
/**
|
||||
* Detach buffer.
|
||||
* Turns off initialization logs buffering.
|
||||
*/
|
||||
static detachBuffer(): void;
|
||||
static getTimestamp(): string;
|
||||
static overrideLogger(logger: LoggerService | LogLevel[] | boolean): any;
|
||||
static isLevelEnabled(level: LogLevel): boolean;
|
||||
private registerLocalInstanceRef;
|
||||
}
|
||||
export {};
|
||||
251
node_modules/@nestjs/common/services/logger.service.js
generated
vendored
Normal file
251
node_modules/@nestjs/common/services/logger.service.js
generated
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
"use strict";
|
||||
var Logger_1;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Logger = exports.LOG_LEVELS = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const core_1 = require("../decorators/core");
|
||||
const shared_utils_1 = require("../utils/shared.utils");
|
||||
const console_logger_service_1 = require("./console-logger.service");
|
||||
const utils_1 = require("./utils");
|
||||
exports.LOG_LEVELS = [
|
||||
'verbose',
|
||||
'debug',
|
||||
'log',
|
||||
'warn',
|
||||
'error',
|
||||
'fatal',
|
||||
];
|
||||
const DEFAULT_LOGGER = new console_logger_service_1.ConsoleLogger();
|
||||
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
||||
year: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
second: 'numeric',
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
});
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
let Logger = Logger_1 = class Logger {
|
||||
constructor(context, options = {}) {
|
||||
this.context = context;
|
||||
this.options = options;
|
||||
}
|
||||
get localInstance() {
|
||||
if (Logger_1.staticInstanceRef === DEFAULT_LOGGER) {
|
||||
return this.registerLocalInstanceRef();
|
||||
}
|
||||
else if (Logger_1.staticInstanceRef instanceof Logger_1) {
|
||||
const prototype = Object.getPrototypeOf(Logger_1.staticInstanceRef);
|
||||
if (prototype.constructor === Logger_1) {
|
||||
return this.registerLocalInstanceRef();
|
||||
}
|
||||
}
|
||||
return Logger_1.staticInstanceRef;
|
||||
}
|
||||
error(message, ...optionalParams) {
|
||||
optionalParams = this.context
|
||||
? (optionalParams.length ? optionalParams : [undefined]).concat(this.context)
|
||||
: optionalParams;
|
||||
this.localInstance?.error(message, ...optionalParams);
|
||||
}
|
||||
log(message, ...optionalParams) {
|
||||
optionalParams = this.context
|
||||
? optionalParams.concat(this.context)
|
||||
: optionalParams;
|
||||
this.localInstance?.log(message, ...optionalParams);
|
||||
}
|
||||
warn(message, ...optionalParams) {
|
||||
optionalParams = this.context
|
||||
? optionalParams.concat(this.context)
|
||||
: optionalParams;
|
||||
this.localInstance?.warn(message, ...optionalParams);
|
||||
}
|
||||
debug(message, ...optionalParams) {
|
||||
optionalParams = this.context
|
||||
? optionalParams.concat(this.context)
|
||||
: optionalParams;
|
||||
this.localInstance?.debug?.(message, ...optionalParams);
|
||||
}
|
||||
verbose(message, ...optionalParams) {
|
||||
optionalParams = this.context
|
||||
? optionalParams.concat(this.context)
|
||||
: optionalParams;
|
||||
this.localInstance?.verbose?.(message, ...optionalParams);
|
||||
}
|
||||
fatal(message, ...optionalParams) {
|
||||
optionalParams = this.context
|
||||
? optionalParams.concat(this.context)
|
||||
: optionalParams;
|
||||
this.localInstance?.fatal?.(message, ...optionalParams);
|
||||
}
|
||||
static error(message, ...optionalParams) {
|
||||
this.staticInstanceRef?.error(message, ...optionalParams);
|
||||
}
|
||||
static log(message, ...optionalParams) {
|
||||
this.staticInstanceRef?.log(message, ...optionalParams);
|
||||
}
|
||||
static warn(message, ...optionalParams) {
|
||||
this.staticInstanceRef?.warn(message, ...optionalParams);
|
||||
}
|
||||
static debug(message, ...optionalParams) {
|
||||
this.staticInstanceRef?.debug?.(message, ...optionalParams);
|
||||
}
|
||||
static verbose(message, ...optionalParams) {
|
||||
this.staticInstanceRef?.verbose?.(message, ...optionalParams);
|
||||
}
|
||||
static fatal(message, ...optionalParams) {
|
||||
this.staticInstanceRef?.fatal?.(message, ...optionalParams);
|
||||
}
|
||||
/**
|
||||
* Print buffered logs and detach buffer.
|
||||
*/
|
||||
static flush() {
|
||||
this.isBufferAttached = false;
|
||||
this.logBuffer.forEach(item => item.methodRef(...item.arguments));
|
||||
this.logBuffer = [];
|
||||
}
|
||||
/**
|
||||
* Attach buffer.
|
||||
* Turns on initialization logs buffering.
|
||||
*/
|
||||
static attachBuffer() {
|
||||
this.isBufferAttached = true;
|
||||
}
|
||||
/**
|
||||
* Detach buffer.
|
||||
* Turns off initialization logs buffering.
|
||||
*/
|
||||
static detachBuffer() {
|
||||
this.isBufferAttached = false;
|
||||
}
|
||||
static getTimestamp() {
|
||||
return dateTimeFormatter.format(Date.now());
|
||||
}
|
||||
static overrideLogger(logger) {
|
||||
if (Array.isArray(logger)) {
|
||||
Logger_1.logLevels = logger;
|
||||
return this.staticInstanceRef?.setLogLevels?.(logger);
|
||||
}
|
||||
if ((0, shared_utils_1.isObject)(logger)) {
|
||||
if (logger instanceof Logger_1 && logger.constructor !== Logger_1) {
|
||||
const errorMessage = `Using the "extends Logger" instruction is not allowed in Nest v9. Please, use "extends ConsoleLogger" instead.`;
|
||||
this.staticInstanceRef?.error(errorMessage);
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
this.staticInstanceRef = logger;
|
||||
}
|
||||
else {
|
||||
this.staticInstanceRef = undefined;
|
||||
}
|
||||
}
|
||||
static isLevelEnabled(level) {
|
||||
const logLevels = Logger_1.logLevels;
|
||||
return (0, utils_1.isLogLevelEnabled)(level, logLevels);
|
||||
}
|
||||
registerLocalInstanceRef() {
|
||||
if (this.localInstanceRef) {
|
||||
return this.localInstanceRef;
|
||||
}
|
||||
this.localInstanceRef = new console_logger_service_1.ConsoleLogger(this.context, {
|
||||
timestamp: this.options?.timestamp,
|
||||
logLevels: Logger_1.logLevels,
|
||||
});
|
||||
return this.localInstanceRef;
|
||||
}
|
||||
};
|
||||
exports.Logger = Logger;
|
||||
Logger.logBuffer = new Array();
|
||||
Logger.staticInstanceRef = DEFAULT_LOGGER;
|
||||
Logger.WrapBuffer = (target, propertyKey, descriptor) => {
|
||||
const originalFn = descriptor.value;
|
||||
descriptor.value = function (...args) {
|
||||
if (Logger_1.isBufferAttached) {
|
||||
Logger_1.logBuffer.push({
|
||||
methodRef: originalFn.bind(this),
|
||||
arguments: args,
|
||||
});
|
||||
return;
|
||||
}
|
||||
return originalFn.call(this, ...args);
|
||||
};
|
||||
};
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger.prototype, "error", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger.prototype, "log", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger.prototype, "warn", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger.prototype, "debug", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger.prototype, "verbose", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger.prototype, "fatal", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger, "error", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger, "log", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger, "warn", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger, "debug", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger, "verbose", null);
|
||||
tslib_1.__decorate([
|
||||
Logger.WrapBuffer,
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], Logger, "fatal", null);
|
||||
exports.Logger = Logger = Logger_1 = tslib_1.__decorate([
|
||||
(0, core_1.Injectable)(),
|
||||
tslib_1.__param(0, (0, core_1.Optional)()),
|
||||
tslib_1.__param(1, (0, core_1.Optional)()),
|
||||
tslib_1.__metadata("design:paramtypes", [String, Object])
|
||||
], Logger);
|
||||
5
node_modules/@nestjs/common/services/utils/filter-log-levels.util.d.ts
generated
vendored
Normal file
5
node_modules/@nestjs/common/services/utils/filter-log-levels.util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { LogLevel } from '../logger.service';
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export declare function filterLogLevels(parseableString?: string): LogLevel[];
|
||||
23
node_modules/@nestjs/common/services/utils/filter-log-levels.util.js
generated
vendored
Normal file
23
node_modules/@nestjs/common/services/utils/filter-log-levels.util.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.filterLogLevels = filterLogLevels;
|
||||
const logger_service_1 = require("../logger.service");
|
||||
const is_log_level_util_1 = require("./is-log-level.util");
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
function filterLogLevels(parseableString = '') {
|
||||
const sanitizedString = parseableString.replaceAll(' ', '').toLowerCase();
|
||||
if (sanitizedString[0] === '>') {
|
||||
const orEqual = sanitizedString[1] === '=';
|
||||
const logLevelIndex = logger_service_1.LOG_LEVELS.indexOf(sanitizedString.substring(orEqual ? 2 : 1));
|
||||
if (logLevelIndex === -1) {
|
||||
throw new Error(`parse error (unknown log level): ${sanitizedString}`);
|
||||
}
|
||||
return logger_service_1.LOG_LEVELS.slice(orEqual ? logLevelIndex : logLevelIndex + 1);
|
||||
}
|
||||
else if (sanitizedString.includes(',')) {
|
||||
return sanitizedString.split(',').filter(is_log_level_util_1.isLogLevel);
|
||||
}
|
||||
return (0, is_log_level_util_1.isLogLevel)(sanitizedString) ? [sanitizedString] : logger_service_1.LOG_LEVELS;
|
||||
}
|
||||
3
node_modules/@nestjs/common/services/utils/index.d.ts
generated
vendored
Normal file
3
node_modules/@nestjs/common/services/utils/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './filter-log-levels.util';
|
||||
export * from './is-log-level-enabled.util';
|
||||
export * from './is-log-level.util';
|
||||
6
node_modules/@nestjs/common/services/utils/index.js
generated
vendored
Normal file
6
node_modules/@nestjs/common/services/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./filter-log-levels.util"), exports);
|
||||
tslib_1.__exportStar(require("./is-log-level-enabled.util"), exports);
|
||||
tslib_1.__exportStar(require("./is-log-level.util"), exports);
|
||||
7
node_modules/@nestjs/common/services/utils/is-log-level-enabled.util.d.ts
generated
vendored
Normal file
7
node_modules/@nestjs/common/services/utils/is-log-level-enabled.util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { LogLevel } from '../logger.service';
|
||||
/**
|
||||
* Checks if target level is enabled.
|
||||
* @param targetLevel target level
|
||||
* @param logLevels array of enabled log levels
|
||||
*/
|
||||
export declare function isLogLevelEnabled(targetLevel: LogLevel, logLevels: LogLevel[] | undefined): boolean;
|
||||
32
node_modules/@nestjs/common/services/utils/is-log-level-enabled.util.js
generated
vendored
Normal file
32
node_modules/@nestjs/common/services/utils/is-log-level-enabled.util.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isLogLevelEnabled = isLogLevelEnabled;
|
||||
const LOG_LEVEL_VALUES = {
|
||||
verbose: 0,
|
||||
debug: 1,
|
||||
log: 2,
|
||||
warn: 3,
|
||||
error: 4,
|
||||
fatal: 5,
|
||||
};
|
||||
/**
|
||||
* Checks if target level is enabled.
|
||||
* @param targetLevel target level
|
||||
* @param logLevels array of enabled log levels
|
||||
*/
|
||||
function isLogLevelEnabled(targetLevel, logLevels) {
|
||||
if (!logLevels || (Array.isArray(logLevels) && logLevels?.length === 0)) {
|
||||
return false;
|
||||
}
|
||||
if (logLevels.includes(targetLevel)) {
|
||||
return true;
|
||||
}
|
||||
let highestLogLevelValue = -Infinity;
|
||||
for (const level of logLevels) {
|
||||
const v = LOG_LEVEL_VALUES[level];
|
||||
if (v > highestLogLevelValue)
|
||||
highestLogLevelValue = v;
|
||||
}
|
||||
const targetLevelValue = LOG_LEVEL_VALUES[targetLevel];
|
||||
return targetLevelValue >= highestLogLevelValue;
|
||||
}
|
||||
5
node_modules/@nestjs/common/services/utils/is-log-level.util.d.ts
generated
vendored
Normal file
5
node_modules/@nestjs/common/services/utils/is-log-level.util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { LogLevel } from '../logger.service';
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export declare function isLogLevel(maybeLogLevel: any): maybeLogLevel is LogLevel;
|
||||
10
node_modules/@nestjs/common/services/utils/is-log-level.util.js
generated
vendored
Normal file
10
node_modules/@nestjs/common/services/utils/is-log-level.util.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isLogLevel = isLogLevel;
|
||||
const logger_service_1 = require("../logger.service");
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
function isLogLevel(maybeLogLevel) {
|
||||
return logger_service_1.LOG_LEVELS.includes(maybeLogLevel);
|
||||
}
|
||||
Reference in New Issue
Block a user