MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / logLock

Function logLock

packages/internal/src/db/advisory-lock.ts:29–41  ·  view source on GitHub ↗
(level: 'info' | 'error' | 'warn', message: string, data?: Record<string, unknown>)

Source from the content-addressed store, hash-verified

27
28// Diagnostic logging helper with timestamp and process info
29function logLock(level: 'info' | 'error' | 'warn', message: string, data?: Record<string, unknown>): void {
30 const timestamp = new Date().toISOString()
31 const pid = process.pid
32 const prefix = `[${timestamp}] [PID:${pid}] [advisory-lock]`
33 const dataStr = data ? ` ${JSON.stringify(data)}` : ''
34 if (level === 'error') {
35 console.error(`${prefix} ${message}${dataStr}`)
36 } else if (level === 'warn') {
37 console.warn(`${prefix} ${message}${dataStr}`)
38 } else {
39 console.log(`${prefix} ${message}${dataStr}`)
40 }
41}
42
43export interface LockHandle {
44 /** Register a callback to be called if the lock is lost (connection dies) */

Callers 3

tryAcquireAdvisoryLockFunction · 0.85
triggerLostFunction · 0.85
releaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected