Appearance
Class: LogsDataStorageService
Persistent log of the app: a list of free-form entries (Record<string, any>) stacked over time and stored server-side. Ideal for keeping a history (games played, successive winners, notable events…).
Remarks
Accessible everywhere via k.logsStorage. You never have to instantiate this service yourself — it is created by the SDK at the startup of the app/widget.
Whereas k.dataStorage keeps a current state (a single object overwritten on each save), this service stacks entries that you can read back later.
Example
ts
// Record each winner, then read back the last 10
await k.logsStorage.add({ winner: user.display_name, at: Date.now() });
const recent = await k.logsStorage.get(10);Implements
Methods
add()
ts
add(data): Promise<void>;Adds an entry to the app's log.
Parameters
data
Record<string, any>
The object to stack onto the history.
Returns
Promise<void>
A promise resolved once the entry has been added.
Example
ts
await k.logsStorage.add({ action: 'game_started', at: Date.now() });See
get to read back the entries.
Deprecated
Use logsStorageV2.add().
clear()
ts
clear(): Promise<void>;Completely clears the app's log.
Returns
Promise<void>
A promise resolved once the history has been erased.
Deprecated
Use logsStorageV2.clear().
get()
ts
get(count?): Promise<Record<string, any>[]>;Retrieves the most recent entries from the app's log.
Parameters
count?
number = 100
Maximum number of entries to retrieve (the most recent ones).
Returns
Promise<Record<string, any>[]>
The list of stored entries.
Default Value
100
Example
ts
const logs = await k.logsStorage.get(20);
console.log(`${logs.length} entries in the history`);See
add to add an entry.
Deprecated
Use logsStorageV2.get().