diff --git a/types/browser-bunyan/browser-bunyan-tests.ts b/types/browser-bunyan/browser-bunyan-tests.ts index 6cf1bf926b..9dcb519c27 100644 --- a/types/browser-bunyan/browser-bunyan-tests.ts +++ b/types/browser-bunyan/browser-bunyan-tests.ts @@ -23,3 +23,19 @@ const myObject = { x: 1, y: 2 }; log.info({ obj: myObject }, 'This is my object:'); new bunyan.ConsoleFormattedStream({ logByLevel: true }); + +const style = { + levels: { + trace: 'color: DeepPink', + debug: 'color: GoldenRod', + info: 'color: DarkTurquoise', + warn: 'color: Purple', + error: 'color: Crimson', + fatal: 'color: Black', + }, + def: 'color: DimGray', + msg: 'color: SteelBlue', + src: 'color: DimGray; font-style: italic; font-size: 0.9em', +}; + +new bunyan.ConsoleFormattedStream({ css: style }); diff --git a/types/browser-bunyan/index.d.ts b/types/browser-bunyan/index.d.ts index 4fedbcd780..24d4b3e874 100644 --- a/types/browser-bunyan/index.d.ts +++ b/types/browser-bunyan/index.d.ts @@ -10,17 +10,30 @@ import * as bunyan from 'bunyan'; declare namespace BrowserBunyan { + interface ConsoleFormattedStreamLevelStyle { + trace: string; + debug: string; + info: string; + warn: string; + error: string; + fatal: string; + } + + interface ConsoleFormattedStreamStyle { + levels: Partial; + def: string; + msg: string; + src: string; + } + interface ConsoleFormattedStreamOptions { logByLevel?: boolean; + css?: Partial; } - interface ConsoleFormattedStream { - new(options?: ConsoleFormattedStreamOptions): NodeJS.WritableStream; - } + type ConsoleFormattedStream = new(options?: ConsoleFormattedStreamOptions) => NodeJS.WritableStream; - interface ConsoleRawStream { - new(options?: ConsoleFormattedStreamOptions): NodeJS.WritableStream; - } + type ConsoleRawStream = new(options?: ConsoleFormattedStreamOptions) => NodeJS.WritableStream; } type BrowserBunyan = typeof bunyan & {