Kameleoon.Logger behaviour (kameleoon_client v0.8.5)

Copy Markdown

Logger configuration for messages emitted by the native Kameleoon Core.

The logger is global because the underlying Rust Core logger is global.

Summary

Functions

Sets the minimum log level emitted by the native Core.

Routes native Core logs to a custom logger.

Types

level()

@type level() :: :none | :error | :warning | :info | :debug

logger()

@type logger() :: module()

Callbacks

log(level, t)

@callback log(level(), String.t()) :: any()

Functions

set_log_level(level)

@spec set_log_level(level()) :: :ok

Sets the minimum log level emitted by the native Core.

Defaults to :warning.

set_logger(logger)

@spec set_logger(logger() | nil) :: :ok | {:error, Kameleoon.Error.t()}

Routes native Core logs to a custom logger.

The logger must be a module implementing log/2. Pass nil to reset logging back to the Core default logger.