Option Type Default Required Description projectIdstring— Yes Project identifier, auto-creates in desktop app mode"local" | "desktop" | "cloud"— Yes Determines endpoint URL apiKeystring— No API key (required for cloud mode) endpointstring— No Override endpoint URL envstring— No Environment label appNamestring— No Application name appVersionstring— No Application version defaultTagsRecord<string, string>{}No Tags merged into every log batchSizenumber10No Logs before auto-flush flushIntervalnumber5000No Auto-flush interval (ms) maxQueueSizenumber1000No Drop oldest entries when exceeded maxLogRatenumber10No Logs per second (token bucket, 0 = unlimited) maxBurstnumber100No Burst allowance for rate limiting bucketsstring[]— No Typed bucket accessors with autocomplete beforeSend(entry) => entry | null— No Transform or drop logs before batching hooksobject— No Lifecycle hooks (see below) isDisabledbooleanfalseNo Kill switch — disables all logging isDebugbooleanfalseNo Disables gzip compression sessionIdstringauto-generated No Override auto-generated session ID fetchfunctionglobalThis.fetchNo Custom fetch implementation
onLog: ( entry ) => void ; // Called after log is added to queue
onFlush: ( logs , success ) => void ; // Called after batch flush attempt
onError: ( error ) => void ; // Called on flush failure
Mode URL desktophttp://localhost:17655localhttps://local.gunsole.comcloudhttps://api.gunsole.com
Field Type Required Description messagestringYes Human-readable log message bucketstringYes Category name (auto-created) contextRecord<string, unknown>No Arbitrary structured data tagsPartial<Tags> | TagEntry<Tags>[]No Filterable key-value pairs traceIdstringNo Links related log entries
Field Type Required Description contextRecord<string, unknown>No Arbitrary structured data tagsPartial<Tags> | TagEntry<Tags>[]No Filterable key-value pairs traceIdstringNo Links related log entries
These are set automatically by the SDK and sent with every log:
Field Source levelDetermined by method: info(), debug(), warn(), error(), fatal() timestampDate.now() (unix milliseconds)userIdFrom gunsole.setUser({ id: "..." }) sessionIdFrom gunsole.setSessionId("...") or auto-generated envFrom config appNameFrom config appVersionFrom config
Cannot be used with buckets config option:
log, info, debug, warn, error, fatal,
setUser, setSessionId, setDebug, flush, destroy, isDestroyed,
drainBatch, projectId, apiKey, logEndpoint,
attachGlobalErrorHandlers, detachGlobalErrorHandlers
Cannot be used as tag schema keys:
bucket, message, level, timestamp, userId, sessionId, env, appName, appVersion
Export Description createGunsoleClientFactory function to create client GunsoleClientClient class persistSession(@gunsole/web) Cookie-based session persistence
Export Description GunsoleClientConfigConfiguration options LogEntryLog entry structure LogLevel"info" | "debug" | "warn" | "error" | "fatal"LogOptionsOptions passed to log methods TagEntrySingle-key tag entry type UserInfoUser information ClientMode"cloud" | "desktop" | "local"BucketLogOptionsLog options for bucket methods (no bucket/message) BucketLoggerCallable bucket accessor interface WithBucketsMapped type adding bucket accessors to client ReservedBucketNameUnion of reserved bucket names ValidateBucketsCompile-time bucket name validator ReservedTagKeyUnion of reserved tag keys ValidTagSchemaCompile-time tag schema constraint
TypeScript 5.0+ required for const generic inference (bucket literal types)
TypeScript 5.4+ recommended for NoInfer (bucket name compile-time validation)
Target: ES2020
The SDK sends logs via HTTP POST:
Content-Type: application/json
X-Gunsole-SDK-Version: 0.2.0
Authorization: Bearer {apiKey} // only in cloud mode
Retry behavior : 3 attempts with exponential backoff (1s, 2s, 4s) + jitter (0.5-1.5x). HTTP 413 splits the batch and retries. 4xx (except 429) are not retried. Logs are dropped after 10 consecutive flush failures.
Setting Default Description Log retention (days) Unlimited Auto-delete logs older than N days Auto-delete old logs Off Enable/disable retention enforcement
Setting Default Description Log retention (days) Inherits project Override project retention per bucket
Setting Options Description Theme Light / Dark / Auto UI color scheme
Setting Value Default port 17655Host localhost onlyCORS Enabled (all origins) Compression gzip accepted on request body
These are compiled into the desktop app and not user-configurable:
Constant Value Description Log batch size 50 Max logs per flush to DB Batch interval 100ms Max time between DB flushes Frontend buffer ~2000 logs Max in-memory logs in viewer New log animation 3 seconds Green fade duration for new entries
Setting Value Engine SQLite (WAL mode) Location (macOS) ~/Library/Application Support/gunsole/gunsole.dbLocation (Linux) ~/.local/share/gunsole/gunsole.dbLocation (Windows) %APPDATA%\gunsole\gunsole.dbTables workspaces, projects, buckets, filters, logs, tags, log_tag_map, app_preferences Foreign keys Enabled Migrations Auto-run on startup