Merge pull request #31546 from TobyLi96/browser-bunyan-css

[browser-bunyan] Added css property to ConsoleFormattedStreamOptions
This commit is contained in:
Nathan Shively-Sanders
2018-12-19 10:56:53 -08:00
committed by GitHub
2 changed files with 35 additions and 6 deletions
@@ -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 });
+19 -6
View File
@@ -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<ConsoleFormattedStreamLevelStyle>;
def: string;
msg: string;
src: string;
}
interface ConsoleFormattedStreamOptions {
logByLevel?: boolean;
css?: Partial<ConsoleFormattedStreamStyle>;
}
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 & {