UNPKG

@homebridge-plugins/homebridge-lutron-caseta-leap

Version:
58 lines 3.09 kB
import type { Logging } from 'homebridge'; /** * Plugin-level log verbosity setting. Stacks on top of Homebridge's own * log handling and the call-site reclassification done in this PR: * * 'normal' — passthrough. After call-site reclassification, 'info' is * reserved for one-time lifecycle events (startup banner, * per-device discovery, retry attempts); per-event noise * (button presses, mDNS re-announce churn, blind position * reads/writes) is at 'debug'. Default. * 'quiet' — suppress 'info' (and 'success'); pass 'warn'/'error' * through. Useful in production where info banners are * visual noise but you still want to see anomalies. * 'errors-only' — suppress 'info'/'success' AND 'warn'; pass 'error' only. * * 'debug' is intentionally NEVER suppressed by this wrapper; it is gated by * Homebridge's own debug-mode flag, which is the right axis for that. If a * user has enabled debug deliberately for troubleshooting, suppressing it * here would defeat the purpose. */ export type LogLevelOption = 'normal' | 'quiet' | 'errors-only'; /** * Per-button-press logging level. Button presses are special-cased because * they're the primary diagnostic an operator wants for "did my press * register?" troubleshooting, but they're also high-volume noise in steady * state. * * 'info' — visible at info level (legacy behavior; useful when wiring * up automations and you want to see presses without enabling * global Homebridge debug). Default. * 'debug' — visible at debug level only. Quiet in normal logs; flip * Homebridge's global debug to see presses. * 'silent' — never log presses at any level. */ export type ButtonPressLogLevel = 'info' | 'debug' | 'silent'; /** * Wraps a Homebridge Logging instance to apply a user-selected verbosity * filter. Returns the original logger unchanged when level is 'normal' * (zero overhead). For 'quiet' and 'errors-only', returns a callable * function wrapper that no-ops the suppressed methods and delegates the * rest to the original logger. * * Wrapping at the platform level cascades to every device class that reads * `this.platform.log` (PicoRemote, OccupancySensor, SerenaTiltOnlyWoodBlinds, * ButtonTracker via PicoRemote), so this single wrap point governs the * whole plugin. */ export declare function createFilteredLogger(base: Logging, level: LogLevelOption): Logging; /** * Emit a button-press log line at the level specified by the user's * 'buttonPressLogging' option. Used by both PicoRemote (for raw * Press/Release events received from the bridge) and ButtonTracker (for * interpreted short/long/double press events derived from the state * machine). Centralised here so the three states stay in sync between * the two call sites. */ export declare function logButtonPress(log: Logging, level: ButtonPressLogLevel, message: string, ...params: any[]): void; //# sourceMappingURL=Logger.d.ts.map