Skip to content

hap-fluent / getLogger

Function: getLogger()

ts
function getLogger(): Logger;

Defined in: packages/hap-fluent/src/logger.ts:176

Get the current global logger instance.

Returns

Logger

The active pino.Logger instance.

Remarks

If no logger has been configured via configureLogger, a default pino.Logger at info level is created lazily on first call. This lazy initialization ensures hap-fluent never throws on import in environments where Pino is available but configureLogger has not yet been called.

Example

typescript
const logger = getLogger();
logger.info({ deviceId: '123' }, 'Device connected');
logger.error({ err: new Error('Timeout') }, 'Operation failed');

Released under the Apache-2.0 License.