Merge pull request #18727 from kryops/bunyan/nameFromLevel

[bunyan] add levelFromName and nameFromLevel
This commit is contained in:
Andrew Casey
2017-08-09 10:51:22 -07:00
committed by GitHub
7 changed files with 16 additions and 3 deletions
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/LSEducation/bunyan-config
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="bunyan"/>
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/nemtsov/node-bunyan-logentries
// Definitions by: Aymeric Beaumet <http://aymericbeaumet.me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
+5
View File
@@ -129,3 +129,8 @@ class MyLogger extends Logger {
super(options);
}
}
const logLevelString: Logger.LogLevelString = 'warn';
const nameLevel: number = Logger.levelFromName[logLevelString];
const nameLevel2: number = Logger.levelFromName['warn'];
const levelName: string = Logger.nameFromLevel[10];
+6 -1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/trentm/node-bunyan
// Definitions by: Alex Mikhalev <https://github.com/amikhalev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
@@ -210,7 +211,11 @@ declare namespace Logger {
const ERROR: number;
const FATAL: number;
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | number;
type LogLevelString = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
type LogLevel = LogLevelString | number;
const levelFromName: { [name in LogLevelString]: number };
const nameFromLevel: { [level: number]: string };
const stdSerializers: StdSerializers;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/DeadAlready/easy-api-request
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/DeadAlready/easy-xapi-utils
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="easy-jsend" />
/// <reference types="easy-x-headers" />
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/DeadAlready/easy-xapi
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="easy-jsend" />
/// <reference types="bunyan" />