mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Remove winston typings from DT, they are bundled with repo now (#27002)
This commit is contained in:
@@ -1584,6 +1584,12 @@
|
||||
"sourceRepoURL": "http://webix.com",
|
||||
"asOfVersion": "5.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "winston",
|
||||
"typingsPackageName": "winston",
|
||||
"sourceRepoURL": "https://github.com/winstonjs/winston.git",
|
||||
"asOfVersion": "2.4.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "wolfy87-eventemitter",
|
||||
"typingsPackageName": "wolfy87-eventemitter",
|
||||
|
||||
506
types/winston/index.d.ts
vendored
506
types/winston/index.d.ts
vendored
@@ -1,506 +0,0 @@
|
||||
// Type definitions for winston 2.3
|
||||
// Project: https://github.com/flatiron/winston
|
||||
// Definitions by: bonnici <https://github.com/bonnici>, Peter Harris <https://github.com/codeanimal>, DABH <https://github.com/DABH>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/winston.d.ts
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Agent } from 'http';
|
||||
|
||||
declare namespace winston {
|
||||
interface AbstractConfigSetLevels {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
interface AbstractConfigSetColors {
|
||||
[key: string]: string | string[];
|
||||
}
|
||||
|
||||
interface AbstractConfigSet {
|
||||
levels: AbstractConfigSetLevels;
|
||||
colors: AbstractConfigSetColors;
|
||||
}
|
||||
|
||||
interface CliConfigSetLevels extends AbstractConfigSetLevels {
|
||||
error: number;
|
||||
warn: number;
|
||||
help: number;
|
||||
data: number;
|
||||
info: number;
|
||||
debug: number;
|
||||
prompt: number;
|
||||
verbose: number;
|
||||
input: number;
|
||||
silly: number;
|
||||
}
|
||||
|
||||
interface CliConfigSetColors extends AbstractConfigSetColors {
|
||||
error: string | string[];
|
||||
warn: string | string[];
|
||||
help: string | string[];
|
||||
data: string | string[];
|
||||
info: string | string[];
|
||||
debug: string | string[];
|
||||
prompt: string | string[];
|
||||
verbose: string | string[];
|
||||
input: string | string[];
|
||||
silly: string | string[];
|
||||
}
|
||||
interface NpmConfigSetLevels extends AbstractConfigSetLevels {
|
||||
error: number;
|
||||
warn: number;
|
||||
info: number;
|
||||
verbose: number;
|
||||
debug: number;
|
||||
silly: number;
|
||||
}
|
||||
interface NpmConfigSetColors extends AbstractConfigSetColors {
|
||||
error: string | string[];
|
||||
warn: string | string[];
|
||||
info: string | string[];
|
||||
verbose: string | string[];
|
||||
debug: string | string[];
|
||||
silly: string | string[];
|
||||
}
|
||||
interface SyslogConfigSetLevels extends AbstractConfigSetLevels {
|
||||
emerg: number;
|
||||
alert: number;
|
||||
crit: number;
|
||||
error: number;
|
||||
warning: number;
|
||||
notice: number;
|
||||
info: number;
|
||||
debug: number;
|
||||
}
|
||||
interface SyslogConfigSetColors extends AbstractConfigSetColors {
|
||||
emerg: string | string[];
|
||||
alert: string | string[];
|
||||
crit: string | string[];
|
||||
error: string | string[];
|
||||
warning: string | string[];
|
||||
notice: string | string[];
|
||||
info: string | string[];
|
||||
debug: string | string[];
|
||||
}
|
||||
|
||||
interface Winston {
|
||||
config: Config;
|
||||
transports: Transports;
|
||||
Transport: TransportStatic;
|
||||
Logger: LoggerStatic;
|
||||
Container: ContainerStatic;
|
||||
loggers: ContainerInstance;
|
||||
default: LoggerInstance;
|
||||
|
||||
exception: Exception;
|
||||
|
||||
exitOnError: boolean;
|
||||
level: string;
|
||||
|
||||
log: LogMethod;
|
||||
|
||||
silly: LeveledLogMethod;
|
||||
debug: LeveledLogMethod;
|
||||
verbose: LeveledLogMethod;
|
||||
info: LeveledLogMethod;
|
||||
warn: LeveledLogMethod;
|
||||
error: LeveledLogMethod;
|
||||
|
||||
query(options: QueryOptions, callback?: (err: Error, results: any) => void): any;
|
||||
query(callback: (err: Error, results: any) => void): any;
|
||||
stream(options?: any): NodeJS.ReadableStream;
|
||||
handleExceptions(...transports: TransportInstance[]): void;
|
||||
unhandleExceptions(...transports: TransportInstance[]): void;
|
||||
add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance;
|
||||
clear(): void;
|
||||
remove(transport: string | TransportInstance): LoggerInstance;
|
||||
startTimer(): ProfileHandler;
|
||||
profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
addColors(target: AbstractConfigSetColors): any;
|
||||
setLevels(target: AbstractConfigSetLevels): any;
|
||||
cli(): LoggerInstance;
|
||||
close(): void;
|
||||
configure(options: LoggerOptions): void;
|
||||
}
|
||||
|
||||
type CLILoggingLevel = 'error' | 'warn' | 'help' | 'data' | 'info' | 'debug' | 'prompt' | 'verbose' | 'input' | 'silly';
|
||||
type NPMLoggingLevel = 'error' | 'warn' | 'info' | 'verbose' | 'debug' | 'silly';
|
||||
type SyslogLoggingLevel = 'emerg' | 'alert' | 'crit' | 'error' | 'warning' | 'notice' | 'info' | 'debug';
|
||||
|
||||
interface Config {
|
||||
allColors: AbstractConfigSetColors;
|
||||
cli: {levels: CliConfigSetLevels, colors: CliConfigSetColors};
|
||||
npm: {levels: NpmConfigSetLevels, colors: NpmConfigSetColors};
|
||||
syslog: {levels: SyslogConfigSetLevels, colors: SyslogConfigSetColors};
|
||||
|
||||
addColors(colors: AbstractConfigSetColors): void;
|
||||
colorize(level: number, message?: string): string;
|
||||
}
|
||||
|
||||
interface ExceptionProcessInfo {
|
||||
pid: number;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
cwd: string;
|
||||
execPath: string;
|
||||
version: string;
|
||||
argv: string;
|
||||
memoryUsage: NodeJS.MemoryUsage;
|
||||
}
|
||||
|
||||
interface ExceptionOsInfo {
|
||||
loadavg: [number, number, number];
|
||||
uptime: number;
|
||||
}
|
||||
|
||||
interface ExceptionTrace {
|
||||
column: number;
|
||||
file: string;
|
||||
"function": string;
|
||||
line: number;
|
||||
method: string;
|
||||
native: boolean;
|
||||
}
|
||||
|
||||
interface ExceptionAllInfo {
|
||||
date: Date;
|
||||
process: ExceptionProcessInfo;
|
||||
os: ExceptionOsInfo;
|
||||
trace: ExceptionTrace[];
|
||||
stack: string[];
|
||||
}
|
||||
|
||||
interface Exception {
|
||||
getAllInfo(err: Error): ExceptionAllInfo;
|
||||
getProcessInfo(): ExceptionProcessInfo;
|
||||
getOsInfo(): ExceptionOsInfo;
|
||||
getTrace(err: Error): ExceptionTrace[];
|
||||
}
|
||||
|
||||
type MetadataRewriter = (level: string, msg: string, meta: any) => any;
|
||||
|
||||
type MetadataFilter = (level: string, msg: string, meta: any) => string | { msg: any; meta: any; };
|
||||
|
||||
interface LoggerStatic {
|
||||
new (options?: LoggerOptions): LoggerInstance;
|
||||
}
|
||||
|
||||
interface LoggerInstance extends NodeJS.EventEmitter {
|
||||
rewriters: MetadataRewriter[];
|
||||
filters: MetadataFilter[];
|
||||
transports: {[key: string]: TransportInstance};
|
||||
|
||||
extend(target: any): LoggerInstance;
|
||||
|
||||
log: LogMethod;
|
||||
|
||||
// for cli levels
|
||||
error: LeveledLogMethod;
|
||||
warn: LeveledLogMethod;
|
||||
help: LeveledLogMethod;
|
||||
data: LeveledLogMethod;
|
||||
info: LeveledLogMethod;
|
||||
debug: LeveledLogMethod;
|
||||
prompt: LeveledLogMethod;
|
||||
verbose: LeveledLogMethod;
|
||||
input: LeveledLogMethod;
|
||||
silly: LeveledLogMethod;
|
||||
|
||||
// for syslog levels only
|
||||
emerg: LeveledLogMethod;
|
||||
alert: LeveledLogMethod;
|
||||
crit: LeveledLogMethod;
|
||||
warning: LeveledLogMethod;
|
||||
notice: LeveledLogMethod;
|
||||
|
||||
query(options: QueryOptions, callback?: (err: Error, results: any) => void): any;
|
||||
query(callback: (err: Error, results: any) => void): any;
|
||||
stream(options?: any): NodeJS.ReadableStream;
|
||||
close(): void;
|
||||
handleExceptions(...transports: TransportInstance[]): void;
|
||||
unhandleExceptions(...transports: TransportInstance[]): void;
|
||||
add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance;
|
||||
clear(): void;
|
||||
remove(transport: string | TransportInstance): LoggerInstance;
|
||||
startTimer(): ProfileHandler;
|
||||
profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance;
|
||||
configure(options: LoggerOptions): void;
|
||||
setLevels(target: AbstractConfigSetLevels): any;
|
||||
cli(): LoggerInstance;
|
||||
|
||||
level: string;
|
||||
}
|
||||
|
||||
interface LoggerOptions {
|
||||
transports?: TransportInstance[];
|
||||
rewriters?: MetadataRewriter[];
|
||||
filters?: MetadataFilter[];
|
||||
exceptionHandlers?: TransportInstance[];
|
||||
handleExceptions?: boolean;
|
||||
level?: string;
|
||||
levels?: AbstractConfigSetLevels;
|
||||
|
||||
exitOnError?: boolean | ((err: Error) => void);
|
||||
|
||||
// TODO: Need to make instances specific,
|
||||
// and need to get options for each instance.
|
||||
// Unfortunately, the documentation is unhelpful.
|
||||
[optionName: string]: any;
|
||||
}
|
||||
|
||||
interface TransportStatic {
|
||||
new(options?: TransportOptions): TransportInstance;
|
||||
}
|
||||
|
||||
interface TransportInstance extends TransportStatic, NodeJS.EventEmitter {
|
||||
silent: boolean;
|
||||
raw: boolean;
|
||||
name: string;
|
||||
level?: string;
|
||||
handleExceptions: boolean;
|
||||
exceptionsLevel: string;
|
||||
humanReadableUnhandledException: boolean;
|
||||
|
||||
formatQuery(query: (string | Object)): (string | Object);
|
||||
formatter?(options?: any): string;
|
||||
normalizeQuery(options: QueryOptions): QueryOptions;
|
||||
formatResults(results: (Object | any[]), options?: Object): (Object | any[]);
|
||||
logException(msg: string, meta: Object, callback: () => void): void;
|
||||
}
|
||||
|
||||
interface ConsoleTransportInstance extends TransportInstance {
|
||||
json: boolean;
|
||||
colorize: boolean | 'all' | 'level' | 'message';
|
||||
prettyPrint: boolean;
|
||||
timestamp: boolean | (() => string | boolean);
|
||||
showLevel: boolean;
|
||||
label: string|null;
|
||||
logstash: boolean;
|
||||
depth: string|null;
|
||||
align: boolean;
|
||||
stderrLevels: { [key: string]: LeveledLogMethod; };
|
||||
eol: string;
|
||||
|
||||
new(options?: ConsoleTransportOptions): ConsoleTransportInstance;
|
||||
stringify?(obj: Object): string;
|
||||
}
|
||||
|
||||
interface DailyRotateFileTransportInstance extends TransportInstance {
|
||||
new(options?: DailyRotateFileTransportOptions): DailyRotateFileTransportInstance;
|
||||
}
|
||||
|
||||
interface FileTransportInstance extends TransportInstance {
|
||||
json: boolean;
|
||||
logstash: boolean;
|
||||
colorize: boolean | 'all' | 'level' | 'message';
|
||||
maxsize: number|null;
|
||||
rotationFormat: boolean;
|
||||
zippedArchive: boolean;
|
||||
maxFiles: number|null;
|
||||
prettyPrint: boolean;
|
||||
label: string|null;
|
||||
timestamp: boolean | (() => string | boolean);
|
||||
eol: string;
|
||||
tailable: boolean;
|
||||
depth: string|null;
|
||||
showLevel: boolean;
|
||||
maxRetries: number;
|
||||
|
||||
close(): void;
|
||||
new(options?: FileTransportOptions): FileTransportInstance;
|
||||
stringify?(obj: Object): string;
|
||||
}
|
||||
|
||||
interface HttpTransportInstance extends TransportInstance {
|
||||
name: string;
|
||||
ssl: boolean;
|
||||
host: string;
|
||||
port: number;
|
||||
auth?: {username: string, password: string};
|
||||
path: string;
|
||||
agent?: Agent|null;
|
||||
|
||||
new(options?: HttpTransportOptions): HttpTransportInstance;
|
||||
}
|
||||
|
||||
interface MemoryTransportInstance extends TransportInstance {
|
||||
errorOutput: GenericTextTransportOptions[];
|
||||
writeOutput: GenericTextTransportOptions[];
|
||||
|
||||
json: boolean;
|
||||
colorize: boolean | 'all' | 'level' | 'message';
|
||||
prettyPrint: boolean;
|
||||
timestamp: boolean | (() => string | boolean);
|
||||
showLevel: boolean;
|
||||
label: string|null;
|
||||
depth: string|null;
|
||||
|
||||
new(options?: MemoryTransportOptions): MemoryTransportInstance;
|
||||
stringify?(obj: Object): string;
|
||||
}
|
||||
|
||||
interface WebhookTransportInstance extends TransportInstance {
|
||||
new(options?: WebhookTransportOptions): WebhookTransportInstance;
|
||||
}
|
||||
|
||||
interface WinstonModuleTrasportInstance extends TransportInstance {
|
||||
new(options?: WinstonModuleTransportOptions): WinstonModuleTrasportInstance;
|
||||
}
|
||||
|
||||
interface ContainerStatic {
|
||||
new(options: LoggerOptions): ContainerInstance;
|
||||
}
|
||||
|
||||
interface ContainerInstance extends ContainerStatic {
|
||||
get(id: string, options?: LoggerOptions): LoggerInstance;
|
||||
add(id: string, options: LoggerOptions): LoggerInstance;
|
||||
has(id: string): boolean;
|
||||
close(id: string): void;
|
||||
options: LoggerOptions;
|
||||
loggers: {[key: string]: LoggerInstance};
|
||||
default: LoggerOptions;
|
||||
}
|
||||
|
||||
interface Transports {
|
||||
File: FileTransportInstance;
|
||||
Console: ConsoleTransportInstance;
|
||||
Loggly: WinstonModuleTrasportInstance;
|
||||
DailyRotateFile: DailyRotateFileTransportInstance;
|
||||
Http: HttpTransportInstance;
|
||||
Memory: MemoryTransportInstance;
|
||||
Webhook: WebhookTransportInstance;
|
||||
}
|
||||
|
||||
type TransportOptions = ConsoleTransportOptions | DailyRotateFileTransportOptions | FileTransportOptions
|
||||
| HttpTransportOptions | MemoryTransportOptions | WebhookTransportOptions | WinstonModuleTransportOptions;
|
||||
|
||||
interface GenericTransportOptions {
|
||||
level?: string;
|
||||
silent?: boolean;
|
||||
raw?: boolean;
|
||||
name?: string;
|
||||
handleExceptions?: boolean;
|
||||
exceptionsLevel?: string;
|
||||
humanReadableUnhandledException?: boolean;
|
||||
|
||||
formatter?(options?: any): string;
|
||||
}
|
||||
|
||||
interface GenericTextTransportOptions {
|
||||
json?: boolean;
|
||||
colorize?: boolean | 'all' | 'level' | 'message';
|
||||
colors?: any;
|
||||
prettyPrint?: boolean;
|
||||
showLevel?: boolean;
|
||||
label?: string;
|
||||
depth?: number;
|
||||
|
||||
timestamp?: boolean | (() => string | boolean);
|
||||
stringify?(obj: any): string;
|
||||
}
|
||||
|
||||
interface GenericNetworkTransportOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
auth?: {
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
path?: string;
|
||||
}
|
||||
|
||||
interface ConsoleTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
logstash?: boolean;
|
||||
debugStdout?: boolean;
|
||||
}
|
||||
|
||||
interface DailyRotateFileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
logstash?: boolean;
|
||||
maxsize?: number;
|
||||
maxFiles?: number;
|
||||
eol?: string;
|
||||
maxRetries?: number;
|
||||
datePattern?: string;
|
||||
filename?: string;
|
||||
dirname?: string;
|
||||
options?: {
|
||||
flags?: string;
|
||||
highWaterMark?: number;
|
||||
};
|
||||
stream?: NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
interface FileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
logstash?: boolean;
|
||||
maxsize?: number;
|
||||
rotationFormat?: boolean;
|
||||
zippedArchive?: boolean;
|
||||
maxFiles?: number;
|
||||
eol?: string;
|
||||
tailable?: boolean;
|
||||
maxRetries?: number;
|
||||
filename?: string;
|
||||
dirname?: string;
|
||||
options?: {
|
||||
flags?: string;
|
||||
highWaterMark?: number;
|
||||
};
|
||||
stream?: NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
interface HttpTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions {
|
||||
ssl?: boolean;
|
||||
}
|
||||
|
||||
interface MemoryTransportOptions extends GenericTransportOptions, GenericTextTransportOptions {
|
||||
}
|
||||
|
||||
interface WebhookTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions {
|
||||
method?: string;
|
||||
ssl?: {
|
||||
key?: any;
|
||||
cert?: any;
|
||||
ca: any;
|
||||
};
|
||||
}
|
||||
|
||||
interface WinstonModuleTransportOptions extends GenericTransportOptions {
|
||||
[optionName: string]: any;
|
||||
}
|
||||
|
||||
interface QueryOptions {
|
||||
rows?: number;
|
||||
limit?: number;
|
||||
start?: number;
|
||||
from?: Date;
|
||||
until?: Date;
|
||||
order?: "asc" | "desc";
|
||||
fields: any;
|
||||
}
|
||||
|
||||
interface ProfileHandler {
|
||||
logger: LoggerInstance;
|
||||
start: Date;
|
||||
|
||||
done(msg: string): LoggerInstance;
|
||||
}
|
||||
|
||||
interface LogMethod {
|
||||
(level: string, msg: string, callback: LogCallback): LoggerInstance;
|
||||
(level: string, msg: string, meta: any, callback: LogCallback): LoggerInstance;
|
||||
(level: string, msg: string, ...meta: any[]): LoggerInstance;
|
||||
}
|
||||
|
||||
interface LeveledLogMethod {
|
||||
(msg: string, callback: LogCallback): LoggerInstance;
|
||||
(msg: string, meta: any, callback: LogCallback): LoggerInstance;
|
||||
(msg: string, ...meta: any[]): LoggerInstance;
|
||||
}
|
||||
|
||||
type LogCallback = (error?: any, level?: string, msg?: string, meta?: any) => void;
|
||||
}
|
||||
|
||||
declare const winston: winston.Winston;
|
||||
export = winston;
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"winston-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"no-misused-new": false
|
||||
}
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
import winston = require('winston');
|
||||
|
||||
declare const str: string;
|
||||
let bool: boolean;
|
||||
declare const num: number;
|
||||
declare const metadata: any;
|
||||
const obj: any = {};
|
||||
declare const stamp: boolean | (() => string | boolean);
|
||||
|
||||
winston.level = 'debug';
|
||||
|
||||
let queryOptions: winston.QueryOptions;
|
||||
declare const transportOptions: winston.TransportOptions;
|
||||
const loggerOptions: winston.LoggerOptions = {
|
||||
transports: [new (winston.Transport)()],
|
||||
rewriters: [
|
||||
(level: string, msg: string, meta: any): any => {
|
||||
return meta;
|
||||
}
|
||||
],
|
||||
exceptionHandlers: [new (winston.Transport)()],
|
||||
handleExceptions: false
|
||||
};
|
||||
|
||||
declare const options: any;
|
||||
let value: any;
|
||||
let transport: winston.TransportInstance;
|
||||
let logger: winston.LoggerInstance;
|
||||
let profiler: winston.ProfileHandler;
|
||||
|
||||
declare const writeableStream: NodeJS.WritableStream;
|
||||
let readableStream: NodeJS.ReadableStream;
|
||||
|
||||
const transportStatic: winston.TransportStatic = winston.Transport;
|
||||
|
||||
let transportInstance: winston.TransportInstance = new (winston.Transport)(transportOptions);
|
||||
transportInstance = new (winston.Transport)();
|
||||
|
||||
const containerInstance: winston.ContainerInstance = new (winston.Container)(loggerOptions);
|
||||
winston.loggers.options.transports = [
|
||||
new (winston.Transport)()
|
||||
];
|
||||
winston.loggers.add('category1', {
|
||||
console: {
|
||||
level: 'silly',
|
||||
colorize: 'true',
|
||||
label: 'category one'
|
||||
},
|
||||
file: {
|
||||
filename: '/path/to/some/file'
|
||||
},
|
||||
transports: [
|
||||
new (winston.Transport)()
|
||||
]
|
||||
});
|
||||
logger = winston.loggers.get('category1');
|
||||
|
||||
bool = containerInstance.has(str);
|
||||
logger = containerInstance.get(str, loggerOptions);
|
||||
containerInstance.close(str);
|
||||
|
||||
transport = winston.transports.Console;
|
||||
transport = winston.transports.DailyRotateFile;
|
||||
transport = winston.transports.File;
|
||||
transport = winston.transports.Http;
|
||||
transport = winston.transports.Loggly;
|
||||
transport = winston.transports.Memory;
|
||||
transport = winston.transports.Webhook;
|
||||
|
||||
value = transport.formatQuery({});
|
||||
queryOptions = transport.normalizeQuery(queryOptions);
|
||||
value = transport.formatResults([], {});
|
||||
transport.logException(str, metadata, () => { });
|
||||
|
||||
winston.exitOnError = bool;
|
||||
|
||||
winston.log(str, str);
|
||||
winston.log(str, str, metadata);
|
||||
winston.log(str, str, metadata, metadata, metadata);
|
||||
winston.silly(str, str);
|
||||
winston.silly(str, str, metadata);
|
||||
winston.silly(str, str, metadata, metadata, metadata);
|
||||
winston.debug(str);
|
||||
winston.debug(str, metadata);
|
||||
winston.debug(str, metadata, metadata, metadata);
|
||||
winston.verbose(str, str);
|
||||
winston.verbose(str, str, metadata);
|
||||
winston.verbose(str, str, metadata, metadata, metadata);
|
||||
winston.info(str);
|
||||
winston.info(str, metadata);
|
||||
winston.info(str, metadata, metadata, metadata);
|
||||
winston.warn(str);
|
||||
winston.warn(str, metadata);
|
||||
winston.warn(str, metadata, metadata, metadata);
|
||||
winston.error(str);
|
||||
winston.error(str, metadata);
|
||||
winston.error(str, metadata, metadata, metadata);
|
||||
|
||||
winston.query(queryOptions, (err: Error, results: any): void => {
|
||||
});
|
||||
winston.query((err: Error, results: any): void => {
|
||||
});
|
||||
|
||||
logger = winston.add(transport, transportOptions);
|
||||
logger = winston.remove(transport);
|
||||
logger = winston.add(transport, {filename: 'path/to/file.log'});
|
||||
|
||||
winston.clear();
|
||||
logger = winston.profile(str, str, metadata, (err: Error, level: string, msg: string, meta: any): void => {
|
||||
});
|
||||
logger = winston.profile(str);
|
||||
profiler = winston.startTimer();
|
||||
winston.setLevels({});
|
||||
logger = winston.cli();
|
||||
|
||||
winston.handleExceptions(transport);
|
||||
winston.unhandleExceptions(transport);
|
||||
|
||||
readableStream = winston.stream(options);
|
||||
|
||||
readableStream.on('log', (log: any): void => {
|
||||
console.log(log);
|
||||
});
|
||||
|
||||
logger = logger.extend(obj);
|
||||
logger.log(str, str);
|
||||
logger.log(str, str, metadata);
|
||||
logger.log(str, str, metadata, metadata, metadata);
|
||||
logger.debug(str);
|
||||
logger.debug(str, metadata);
|
||||
logger.debug(str, metadata, metadata, metadata);
|
||||
logger.info(str);
|
||||
logger.info(str, metadata);
|
||||
logger.info(str, metadata, metadata, metadata);
|
||||
logger.warn(str);
|
||||
logger.warn(str, metadata);
|
||||
logger.warn(str, metadata, metadata, metadata);
|
||||
logger.error(str);
|
||||
logger.error(str, metadata);
|
||||
logger.error(str, metadata, metadata, metadata);
|
||||
|
||||
logger.query(queryOptions, (err: Error, results: any): void => {
|
||||
});
|
||||
logger.query((err: Error, results: any): void => {
|
||||
});
|
||||
|
||||
readableStream = winston.stream(options);
|
||||
logger.close();
|
||||
logger.handleExceptions(transport);
|
||||
logger.unhandleExceptions(transport);
|
||||
logger = logger.add(transport, transportOptions, bool);
|
||||
logger = logger.add(transport);
|
||||
logger = logger.add(transport, {filename: 'path/to/file.log'});
|
||||
|
||||
logger.clear();
|
||||
logger = logger.remove(transport);
|
||||
profiler = logger.startTimer();
|
||||
logger = logger.profile(str, str, metadata, (err: Error, level: string, msg: string, meta: any): void => {
|
||||
});
|
||||
value = logger.setLevels(value);
|
||||
logger = logger.cli();
|
||||
|
||||
logger = profiler.done(str);
|
||||
logger = profiler.logger;
|
||||
profiler.start = new Date();
|
||||
|
||||
const testRewriter: winston.MetadataRewriter = (level: string, msg: string, meta: any): any => {
|
||||
return meta;
|
||||
};
|
||||
|
||||
logger.rewriters.push(testRewriter);
|
||||
/**
|
||||
* New Logger instances with transports tests:
|
||||
*/
|
||||
|
||||
logger = new (winston.Logger)({
|
||||
transports: [
|
||||
new (winston.transports.Console)({
|
||||
level: str,
|
||||
silent: bool,
|
||||
json: bool,
|
||||
colorize: bool,
|
||||
timestamp: stamp,
|
||||
showLevel: bool,
|
||||
label: str,
|
||||
logstash: bool,
|
||||
debugStdout: bool,
|
||||
depth: num,
|
||||
}),
|
||||
new (winston.transports.DailyRotateFile)({
|
||||
level: str,
|
||||
silent: bool,
|
||||
json: bool,
|
||||
colorize: bool,
|
||||
maxsize: num,
|
||||
maxFiles: num,
|
||||
maxRetries: num,
|
||||
prettyPrint: bool,
|
||||
timestamp: stamp,
|
||||
filename: str,
|
||||
dirname: str,
|
||||
datePattern: str,
|
||||
eol: str,
|
||||
stream: writeableStream,
|
||||
}),
|
||||
new (winston.transports.File)({
|
||||
level: str,
|
||||
silent: bool,
|
||||
json: bool,
|
||||
colorize: bool,
|
||||
prettyPrint: bool,
|
||||
timestamp: stamp,
|
||||
showLevel: bool,
|
||||
logstash: bool,
|
||||
rotationFormat: bool,
|
||||
depth: num,
|
||||
zippedArchive: bool,
|
||||
eol: str,
|
||||
tailable: bool,
|
||||
maxRetries: num,
|
||||
filename: str,
|
||||
maxsize: num,
|
||||
maxFiles: num,
|
||||
stream: writeableStream,
|
||||
}),
|
||||
new (winston.transports.Http)({
|
||||
level: str,
|
||||
host: str,
|
||||
port: num,
|
||||
path: str,
|
||||
auth: { username: str, password: str },
|
||||
ssl: bool,
|
||||
}),
|
||||
new (winston.transports.Loggly)({
|
||||
level: str,
|
||||
subdomain: str,
|
||||
auth: {},
|
||||
inputName: str,
|
||||
json: bool,
|
||||
}),
|
||||
new (winston.transports.Memory)({
|
||||
level: str,
|
||||
json: bool,
|
||||
colorize: bool,
|
||||
showLevel: bool,
|
||||
depth: num,
|
||||
timestamp: stamp,
|
||||
label: str,
|
||||
}),
|
||||
new (winston.transports.Webhook)({
|
||||
level: str,
|
||||
name: str,
|
||||
host: str,
|
||||
port: num,
|
||||
method: str,
|
||||
path: str,
|
||||
auth: { username: str, password: str },
|
||||
ssl: {ca: {}},
|
||||
}),
|
||||
]
|
||||
});
|
||||
|
||||
/* Remove transport by name */
|
||||
logger = logger.remove('nooo');
|
||||
|
||||
/* Reconfigure logger */
|
||||
logger.configure({ level: 'silly' });
|
||||
|
||||
winston.default.warn("Don't export reserved words in JavaScript!");
|
||||
|
||||
winston.default.setLevels(winston.config.syslog.levels);
|
||||
winston.addColors(winston.config.syslog.colors);
|
||||
winston.default.emerg('syslog!');
|
||||
|
||||
winston.config.addColors(winston.config.syslog.colors);
|
||||
winston.config.colorize(winston.config.syslog.levels['info'], "Hello world!");
|
||||
|
||||
// module augment for custom level log
|
||||
// https://github.com/winstonjs/winston#using-custom-logging-levels
|
||||
// https://github.com/Microsoft/TypeScript/issues/7545
|
||||
declare module 'winston' {
|
||||
interface LoggerInstance {
|
||||
yay: LeveledLogMethod;
|
||||
}
|
||||
}
|
||||
const customLevelLogger = new winston.Logger({
|
||||
levels: {yay: 0, haha: 1, hoho: 2},
|
||||
transports: [
|
||||
new (winston.transports.Console)()
|
||||
]
|
||||
});
|
||||
customLevelLogger.yay('yay!');
|
||||
Reference in New Issue
Block a user