MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / getCacheLogger

Function getCacheLogger

internal/cache/cache.go:358–384  ·  view source on GitHub ↗

getCacheLogger returns the cache logger, initializing it if necessary.

()

Source from the content-addressed store, hash-verified

356
357// getCacheLogger returns the cache logger, initializing it if necessary.
358func getCacheLogger() interfaces.Logger {
359 cacheLoggerOnce.Do(func() {
360 // Create a logger for cache operations that logs to file
361 // Use debug level if config.DebugEnabled is true
362 level := logger.LevelInfo
363 if config.DebugEnabled {
364 level = logger.LevelDebug
365 }
366
367 var err error
368
369 // Use the global cache directory if available, otherwise fallback to current directory
370 cacheDir := globalCacheDir
371 if cacheDir == "" {
372 cacheDir = "."
373 }
374
375 // Always use our new internal logger system with the cache directory
376 cacheLogger, err = logger.NewInternalLogger(level, cacheDir)
377 if err != nil {
378 // Fallback to simple logger if file logging fails
379 cacheLogger = logger.NewSimpleLogger(level)
380 }
381 })
382
383 return cacheLogger
384}
385
386// InitGlobalCache initializes the global cache with the given directory.
387func InitGlobalCache(cacheDir string) error {

Callers 15

NewFileCacheWithSizeFunction · 0.85
loadCacheFilesMethod · 0.85
GetMethod · 0.85
SetMethod · 0.85
evictLRUMethod · 0.85
DeleteMethod · 0.85
InitGlobalCacheFunction · 0.85
GetNamespacedCacheFunction · 0.85
NewBadgerCacheFunction · 0.85
isLockFileStaleFunction · 0.85
GetMethod · 0.85
SetMethod · 0.85

Calls 2

NewInternalLoggerFunction · 0.92
NewSimpleLoggerFunction · 0.92

Tested by

no test coverage detected