Function: createLog()

createLog(args: { key: string; level: string; lix: Pick<Lix, "sqlite" | "db" | "hooks">; message: string; }): 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').

Example

// Directly log an info message

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

Parameters

ParameterType
args{ key: string; level: string; lix: Pick<Lix, "sqlite" | "db" | "hooks">; message: string; }
args.keystring
args.levelstring
args.lixPick<Lix, "sqlite" | "db" | "hooks">
args.messagestring

Returns

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

A promise that resolves with the created log entry.