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
36 lines • 1.39 kB
TypeScript
import { LogEntry } from '../logger.js';
import { Transform } from '../transform.js';
/** Configuration options for the Caterpillar Filter Transform */
export interface FilterOptions {
/** Use to override the default value of {@link Filter.filterLevel} */
filterLevel?: number;
}
/**
* Caterpillar Filter Transform.
* Filters the log entries, keeping only those equal to or below the specified `filterLevel`.
* @example
* ``` javascript
* import { Logger, Filter } from 'caterpillar'
* const logger = new Logger()
* const filter = new Filter({ filterLevel: 6 })
* logger.pipe(filter).pipe(process.stdout)
* logger.log('info', 'this will be outputted')
* logger.log('debug', 'this will be ignored')
* filter.filterLevel = 5
* logger.log('info', 'now even this will be ignored')
* logger.log('note', 'but not this')
* ```
*/
export declare class Filter extends Transform {
/**
* Only display entries that have a log level below or equal to this number.
* Defaults to `6`, which by default is the info log level.
*/
filterLevel: number;
/** Create our instance and apply our configuraiton options. */
constructor(opts?: FilterOptions);
/** Retain only log entries that are equal to or less than the specified filter level. */
format(entry: LogEntry): LogEntry | null;
}
export default Filter;
//# sourceMappingURL=filter.d.ts.map