Function: createLog()

createLog(args): Promise<LixSelectable<EntityStateView<{ id: LixGenerated<string>; key: string; level: string; message: string; }>>>

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.

It is recommended to use dot notation for log keys (e.g., 'app.module.component').

Parameters

args

key

string

level

string

lix

Pick<Lix, "sqlite" | "db">

message

string

Returns

Promise<LixSelectable<EntityStateView<{ id: LixGenerated<string>; key: string; level: string; message: string; }>>>

A promise that resolves with the created log entry.

Example

// Directly log an info message

if (shouldLog) {
  await createLog({
    lix,
    key: 'app.init',
    level: 'info',
    message: 'Application initialized'
});