import {LogLevel} from './LogLevel';
import {Message} from './message';
export interface Interceptor {
(message: Message): void;
}
export interface FilterLogMessage {
(context: Message): boolean;
}
export function logLevelFilter(level: LogLevel): FilterLogMessage {
return function filterLogLevel(context: Message): boolean {
return context.level.gte(level);
}
}
export function interceptFilter(filter: FilterLogMessage, intercept: Interceptor): Interceptor {
return function filterdInterceptor(context: Message): void {
if (filter(context)) {
intercept(context);
}
}
} |