createLog(
args: {key:string;level:string;lix:Lix;message?:null|string;payload?:JSONType; }):Promise<LixSelectable<EntityStateView<{id:LixGenerated<string>;key:string;level:string;message?:null|string;payload:unknown; }>>>
Directly creates a log entry in the Lix database without applying any filters.
This function inserts the log entry regardless of the lix_log_levels setting
in the key-value store. It is the responsibility of the calling application
to implement any desired log level filtering before invoking this function.
Use snake_case for log keys (e.g., app_checkout_submit) to keep filters predictable.
Provide either a message, a structured payload, or both depending on your needs.
await createLog({
lix,
key: 'app_init',
level: 'info',
message: 'Application initialized'
});await createLog({
lix,
key: 'app_init_state',
level: 'debug',
payload: { ready: true }
});| Parameter | Type |
|---|---|
args | { key: string; level: string; lix: Lix; message?: null | string; payload?: JSONType; } |
args.key | string |
args.level | string |
args.lix | Lix |
args.message? | null | string |
args.payload? | JSONType |
Promise<LixSelectable<EntityStateView<{ id: LixGenerated<string>; key: string; level: string; message?: null | string; payload: unknown; }>>>
A promise that resolves with the created log entry.