1 | import { Transform } from '../transform.js';
|
2 | /** Mapping of ANSI color codes into a CSS style */
|
3 | export interface Styles {
|
4 | [key: string]: {
|
5 | /** The ANSI color code used to start the style */
|
6 | start: string;
|
7 | /** The ANSI color code used to end the style */
|
8 | end: string;
|
9 | /** The CSS style value */
|
10 | value: string;
|
11 | };
|
12 | }
|
13 | /** Configuration optons for the Caterpillar Browser Transform */
|
14 | export interface BrowserOptions {
|
15 | /** Use to override the default value of {@link Filter.color} */
|
16 | color?: boolean;
|
17 | /** Use to override the default value of {@link Filter.console} */
|
18 | output?: boolean;
|
19 | /** Use to override the default value of {@link Filter.styles} */
|
20 | styles?: Styles;
|
21 | }
|
22 | /**
|
23 | * Convert human readable Caterpillar entries into browser compatible entries.
|
24 | * @example
|
25 | * ``` javascript
|
26 | * import { Logger, Human, Browser } from 'caterpillar'
|
27 | * const logger = new Logger()
|
28 | * logger.pipe(new Human()).pipe(new Browser())
|
29 | * logger.log('info', 'some', {data: 'oh yeah'}, 42)
|
30 | * ```
|
31 | */
|
32 | export declare class Browser extends Transform {
|
33 | /** Whether or not we should use color. */
|
34 | color: boolean;
|
35 | /** Whether or not we should write to the browser console. */
|
36 | output: boolean;
|
37 | /** The objects that tell our browser transform how to convert terminal colours into console colours. */
|
38 | styles: Styles;
|
39 | /** Create our instance and apply our configuraiton options. */
|
40 | constructor(opts?: BrowserOptions);
|
41 | /**
|
42 | * Convert a human readable Caterpillar entry into a format that browser consoles can understand.
|
43 | * And if the `write` config property is `true` (it is by default), write the result to the browser console.
|
44 | */
|
45 | format(message: string): string[];
|
46 | }
|
47 | export default Browser;
|
48 | //# sourceMappingURL=browser.d.ts.map |
\ | No newline at end of file |