@furystack/logging
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -25,3 +25,12 @@ import { ILeveledLogEntry, ILogEntry } from './ILogEntries'; | ||
fatal<T>(entry: ILogEntry<T>): Promise<void>; | ||
withScope: (scope: string) => { | ||
addEntry: <T>(entry: ILeveledLogEntry<T>) => Promise<void>; | ||
verbose: <T>(entry: ILogEntry<T>) => Promise<void>; | ||
debug: <T>(entry: ILogEntry<T>) => Promise<void>; | ||
information: <T>(entry: ILogEntry<T>) => Promise<void>; | ||
warning: <T>(entry: ILogEntry<T>) => Promise<void>; | ||
error: <T>(entry: ILogEntry<T>) => Promise<void>; | ||
fatal: <T>(entry: ILogEntry<T>) => Promise<void>; | ||
}; | ||
} | ||
//# sourceMappingURL=AbstractLogger.d.ts.map |
@@ -19,2 +19,11 @@ "use strict"; | ||
constructor(options) { | ||
this.withScope = (scope) => ({ | ||
addEntry: (entry) => this.addEntry({ scope, ...entry }), | ||
verbose: (entry) => this.verbose({ scope, ...entry }), | ||
debug: (entry) => this.debug({ scope, ...entry }), | ||
information: (entry) => this.information({ scope, ...entry }), | ||
warning: (entry) => this.warning({ scope, ...entry }), | ||
error: (entry) => this.error({ scope, ...entry }), | ||
fatal: (entry) => this.fatal({ scope, ...entry }), | ||
}); | ||
this.options = { | ||
@@ -21,0 +30,0 @@ ...exports.defaultLoggerOptions, |
@@ -49,3 +49,3 @@ import { AbstractLogger } from './AbstractLogger'; | ||
*/ | ||
export declare const defaultFormatter: <T>(entry: ILeveledLogEntry<T>) => string[]; | ||
export declare const defaultFormatter: <T>(entry: ILeveledLogEntry<T>) => (string | undefined)[]; | ||
/** | ||
@@ -55,3 +55,3 @@ * Formatter for a verbose message | ||
*/ | ||
export declare const verboseFormatter: <T>(entry: ILeveledLogEntry<T>) => (string | T)[]; | ||
export declare const verboseFormatter: <T>(entry: ILeveledLogEntry<T>) => (string | T | undefined)[]; | ||
/** | ||
@@ -58,0 +58,0 @@ * Options for a Console Logger instance |
@@ -34,3 +34,3 @@ /** | ||
export interface ILogEntry<TData> { | ||
scope: string; | ||
scope?: string; | ||
message: string; | ||
@@ -37,0 +37,0 @@ data?: TData; |
import { ILeveledLogEntry, ILogEntry } from './ILogEntries'; | ||
/** | ||
* Log entry without scope variable | ||
*/ | ||
export declare type LogEntryWithoutScope<T> = Exclude<ILogEntry<T>, { | ||
scope: string; | ||
}>; | ||
/** | ||
* Leveled log entry without scope variable | ||
*/ | ||
export declare type LeveledLogEntryWithoutScope<T> = Exclude<ILeveledLogEntry<T>, { | ||
scope: string; | ||
}>; | ||
/** | ||
* A logger instance with predefined scopes | ||
*/ | ||
export interface ScopedLogger { | ||
addEntry: <T>(entry: LeveledLogEntryWithoutScope<T>) => Promise<void>; | ||
verbose: <T>(entry: LogEntryWithoutScope<T>) => Promise<void>; | ||
debug: <T>(entry: LogEntryWithoutScope<T>) => Promise<void>; | ||
information: <T>(entry: LogEntryWithoutScope<T>) => Promise<void>; | ||
warning: <T>(entry: LogEntryWithoutScope<T>) => Promise<void>; | ||
error: <T>(entry: LogEntryWithoutScope<T>) => Promise<void>; | ||
fatal: <T>(entry: LogEntryWithoutScope<T>) => Promise<void>; | ||
} | ||
/** | ||
* Options type for a Logger instance | ||
@@ -20,3 +44,4 @@ */ | ||
options: ILoggerOptions; | ||
withScope: (scope: string) => ScopedLogger; | ||
} | ||
//# sourceMappingURL=ILogger.d.ts.map |
{ | ||
"name": "@furystack/logging", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Logging API for FuryStack package", | ||
@@ -72,3 +72,3 @@ "main": "dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"gitHead": "2fa8429190fca702d037ea9da26cdc9ded16a8de" | ||
"gitHead": "f1b889fbd2faf4fe923af433e4a3bb9d0d3f71bb" | ||
} |
import { ILeveledLogEntry, ILogEntry, LogLevel } from './ILogEntries' | ||
import { ILogger, ILoggerOptions } from './ILogger' | ||
import { ILogger, ILoggerOptions, LeveledLogEntryWithoutScope, LogEntryWithoutScope } from './ILogger' | ||
@@ -94,2 +94,12 @@ /** | ||
} | ||
public withScope = (scope: string) => ({ | ||
addEntry: <T>(entry: LeveledLogEntryWithoutScope<T>) => this.addEntry<T>({ scope, ...entry }), | ||
verbose: <T>(entry: LogEntryWithoutScope<T>) => this.verbose({ scope, ...entry }), | ||
debug: <T>(entry: LogEntryWithoutScope<T>) => this.debug({ scope, ...entry }), | ||
information: <T>(entry: LogEntryWithoutScope<T>) => this.information({ scope, ...entry }), | ||
warning: <T>(entry: LogEntryWithoutScope<T>) => this.warning({ scope, ...entry }), | ||
error: <T>(entry: LogEntryWithoutScope<T>) => this.error({ scope, ...entry }), | ||
fatal: <T>(entry: LogEntryWithoutScope<T>) => this.fatal({ scope, ...entry }), | ||
}) | ||
} |
@@ -39,3 +39,3 @@ /** | ||
export interface ILogEntry<TData> { | ||
scope: string | ||
scope?: string | ||
message: string | ||
@@ -42,0 +42,0 @@ data?: TData |
import { ILeveledLogEntry, ILogEntry } from './ILogEntries' | ||
/** | ||
* Log entry without scope variable | ||
*/ | ||
export type LogEntryWithoutScope<T> = Exclude<ILogEntry<T>, { scope: string }> | ||
/** | ||
* Leveled log entry without scope variable | ||
*/ | ||
export type LeveledLogEntryWithoutScope<T> = Exclude<ILeveledLogEntry<T>, { scope: string }> | ||
/** | ||
* A logger instance with predefined scopes | ||
*/ | ||
export interface ScopedLogger { | ||
addEntry: <T>(entry: LeveledLogEntryWithoutScope<T>) => Promise<void> | ||
verbose: <T>(entry: LogEntryWithoutScope<T>) => Promise<void> | ||
debug: <T>(entry: LogEntryWithoutScope<T>) => Promise<void> | ||
information: <T>(entry: LogEntryWithoutScope<T>) => Promise<void> | ||
warning: <T>(entry: LogEntryWithoutScope<T>) => Promise<void> | ||
error: <T>(entry: LogEntryWithoutScope<T>) => Promise<void> | ||
fatal: <T>(entry: LogEntryWithoutScope<T>) => Promise<void> | ||
} | ||
/** | ||
* Options type for a Logger instance | ||
@@ -22,2 +45,3 @@ */ | ||
options: ILoggerOptions | ||
withScope: (scope: string) => ScopedLogger | ||
} |
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
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
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
63595
886