caterpillar
Version:
Caterpillar is the ultimate logging system for Deno, Node.js, and Web Browsers. Log levels are implemented to the RFC standard. Log entries can be filtered and piped to various streams, including coloured output to the terminal, the browser's console, and
48 lines • 1.83 kB
TypeScript
import { Transform } from '../transform.js';
/** Mapping of ANSI color codes into a CSS style */
export interface Styles {
[key: string]: {
/** The ANSI color code used to start the style */
start: string;
/** The ANSI color code used to end the style */
end: string;
/** The CSS style value */
value: string;
};
}
/** Configuration optons for the Caterpillar Browser Transform */
export interface BrowserOptions {
/** Use to override the default value of {@link Filter.color} */
color?: boolean;
/** Use to override the default value of {@link Filter.console} */
output?: boolean;
/** Use to override the default value of {@link Filter.styles} */
styles?: Styles;
}
/**
* Convert human readable Caterpillar entries into browser compatible entries.
* @example
* ``` javascript
* import { Logger, Human, Browser } from 'caterpillar'
* const logger = new Logger()
* logger.pipe(new Human()).pipe(new Browser())
* logger.log('info', 'some', {data: 'oh yeah'}, 42)
* ```
*/
export declare class Browser extends Transform {
/** Whether or not we should use color. */
color: boolean;
/** Whether or not we should write to the browser console. */
output: boolean;
/** The objects that tell our browser transform how to convert terminal colours into console colours. */
styles: Styles;
/** Create our instance and apply our configuraiton options. */
constructor(opts?: BrowserOptions);
/**
* Convert a human readable Caterpillar entry into a format that browser consoles can understand.
* And if the `write` config property is `true` (it is by default), write the result to the browser console.
*/
format(message: string): string[];
}
export default Browser;
//# sourceMappingURL=browser.d.ts.map