llm-lean-log-core
📦 Core library for llm-lean-log - Logging for LLMs, but we cut the fat.
llm-lean-log is a format for logging that is optimized for LLM token usage, using a simple CSV-based structure.
For more information, see the main repository.
This package contains the core logic for parsing, saving, and visualizing logs in the llm-lean-log format.
🚀 Installation
bun add llm-lean-log-core
📦 Usage
Managing Logs
import { loadLogs, addLogEntry, saveLogs } from "llm-lean-log-core";
let entries = await loadLogs("logs.csv");
entries = addLogEntry(entries, {
name: "My Log",
problem: "Something happened",
tags: "tag1,tag2"
});
await saveLogs("logs.csv", entries);
Visualizing Logs
import { visualizeTable, visualizeEntry } from "llm-lean-log-core";
const llmTable = visualizeTable(entries, { llm: true });
const humanEntry = visualizeEntry(entries[0], { colors: true });
Advanced CSV Export
import { logEntriesToCSVMinimal } from "llm-lean-log-core";
const minimalCsv = logEntriesToCSVMinimal(entries);
📄 License
MIT