InitGlobalLogger initializes the global logger with the specified cache directory This should be called early in application initialization.
(level Level, cacheDir string)
| 236 | // InitGlobalLogger initializes the global logger with the specified cache directory |
| 237 | // This should be called early in application initialization. |
| 238 | func InitGlobalLogger(level Level, cacheDir string) error { |
| 239 | var err error |
| 240 | |
| 241 | globalLoggerOnce.Do(func() { |
| 242 | // Try to create internal logger with file output |
| 243 | globalLogger, err = NewInternalLogger(level, cacheDir) |
| 244 | if err != nil { |
| 245 | // Fallback to simple logger if file logging fails |
| 246 | globalLogger = NewSimpleLogger(level) |
| 247 | } |
| 248 | }) |
| 249 | |
| 250 | return err |
| 251 | } |
| 252 | |
| 253 | // InitGlobalLoggerWithValidation initializes the global logger with cache directory validation |
| 254 | // This is a convenience function that validates the cache directory before initializing. |
no test coverage detected