Faremeter API / logs/src
logs/src
Interfaces
ConfigureAppArgs
Defined in: packages/logs/src/index.ts:17 Configuration options for initializing the logging system.Properties
backend?
Defined in: packages/logs/src/index.ts:21 Backend implementation to use. Auto-detected if not provided.optionalbackend:LoggingBackend<BaseConfigArgs>
level?
Defined in: packages/logs/src/index.ts:19 Minimum log level to emit. Defaults tooptionallevel:"error"|"info"|"trace"|"debug"|"warning"|"fatal"
"info".
Logger
Defined in: packages/logs/src/types.ts:19Methods
debug()
debug(…Defined in: packages/logs/src/types.ts:20args):void
Parameters
args
…LogArgs
Returns
void
error()
error(…Defined in: packages/logs/src/types.ts:23args):void
Parameters
args
…LogArgs
Returns
void
fatal()
fatal(…Defined in: packages/logs/src/types.ts:24args):void
Parameters
args
…LogArgs
Returns
void
info()
info(…Defined in: packages/logs/src/types.ts:21args):void
Parameters
args
…LogArgs
Returns
void
warning()
warning(…Defined in: packages/logs/src/types.ts:22args):void
Parameters
args
…LogArgs
Returns
void
LoggingBackend
Defined in: packages/logs/src/types.ts:37 Backend implementation for the logging system. Backends handle log output destinations (console, file, external service) and can be swapped at runtime via configureApp.Type Parameters
TConfig
TConfig extends BaseConfigArgs = BaseConfigArgs
Configuration options for this backend.
Methods
configureApp()
configureApp(Defined in: packages/logs/src/types.ts:45 Initializes the backend with the given configuration.args):Promise<void>
Parameters
args
TConfig
Backend-specific configuration including minimum log level.
Returns
Promise<void>
getLogger()
getLogger(Defined in: packages/logs/src/types.ts:53 Creates a logger scoped to a subsystem hierarchy.subsystem):Logger
Parameters
subsystem
readonlystring[]
Hierarchical category for the logger (e.g., ["faremeter", "client"]).
Returns
Logger
A logger instance for the specified subsystem.
Type Aliases
Context
Context =Defined in: packages/logs/src/types.ts:16Record<string,unknown>
LogArgs
LogArgs = [Defined in: packages/logs/src/types.ts:17string,Context]
LogLevel
LogLevel = typeofDefined in: packages/logs/src/types.ts:10LogLevels[number]
Variables
ConsoleBackend
Defined in: packages/logs/src/console.ts:22 Logging backend that outputs to the browser or Node.js console. This is the default fallback backend when logtape is not available. It uses nativeconstConsoleBackend:LoggingBackend
console.debug, console.info, console.warn, and
console.error methods for output.
LogLevels
Defined in: packages/logs/src/types.ts:1constLogLevels: readonly ["trace","debug","info","warning","error","fatal"]
Functions
configureApp()
configureApp(Defined in: packages/logs/src/index.ts:49 Initializes the global logging system. Call this once at application startup to configure the log level and backend. If no backend is specified, logtape is used when available, otherwise falls back to console output.args):Promise<void>
Parameters
args
ConfigureAppArgs = {}
Configuration options for level and backend.
Returns
Promise<void>
Example
getLogger()
getLogger(Defined in: packages/logs/src/index.ts:69 Creates a logger for a specific subsystem. The returned logger automatically adapts if the backend changes after creation (e.g., when configureApp is called later).subsystem):Promise<Logger>
Parameters
subsystem
readonlystring[]
Hierarchical category path for the logger.
Returns
Promise<Logger>
A logger instance scoped to the subsystem.