UNPKG

@livy/util

Version:
23 lines (22 loc) 629 B
import { SeverityMap } from '@livy/contracts/lib/log-level.mjs'; import { Mixin } from '../mixin.mjs'; /** * Implements a level-respecting `isHandling` method */ export const RespectLevelMixin = Mixin(BaseClass => { return class RespectLevelMixin extends BaseClass { constructor() { super(...arguments); /** * The minimum activation level for this handler */ this.level = 'debug'; } /** * @inheritdoc */ isHandling(level) { return SeverityMap[level] <= SeverityMap[this.level]; } }; });