Documentation
¶
Index ¶
- Constants
- func Close() error
- func Debug(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func ErrorPrint(format string, args ...interface{})
- func Info(format string, args ...interface{})
- func Init() error
- func ResetForTesting()
- func SetSession(externalID, sessionID string)
- func Warn(format string, args ...interface{})
- type Level
- type Logger
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) ErrorPrint(format string, args ...interface{})
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) SetAlsoStderr(enabled bool)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetSession(externalID, sessionID string)
- func (l *Logger) SetSessionContext(ctx string)
- func (l *Logger) Warn(format string, args ...interface{})
Constants ¶
const (
// LogDirEnv is the environment variable to override the default log directory
LogDirEnv = "CONFAB_LOG_DIR"
)
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(format string, args ...interface{})
Debug logs a debug message (file only, not shown to user)
func Error ¶
func Error(format string, args ...interface{})
Error logs an error (file only, not shown to user)
func ErrorPrint ¶
func ErrorPrint(format string, args ...interface{})
ErrorPrint logs an error AND prints to stderr for user visibility
func Info ¶
func Info(format string, args ...interface{})
Info logs an info message (file only, not shown to user)
func Init ¶
func Init() error
Init initializes the logger (creates log directory and file).
Test isolation: When running under `go test` (detected via testing.Testing()), if CONFAB_LOG_DIR is not explicitly set, logs are discarded to avoid polluting the real log file. Tests that need to verify log output should set CONFAB_LOG_DIR to a temp directory.
func ResetForTesting ¶
func ResetForTesting()
ResetForTesting resets the singleton state for tests. This allows tests to re-initialize the logger with different settings. Most tests don't need this - the auto-discard behavior handles isolation. Use this when testing logger initialization itself or verifying log output.
func SetSession ¶
func SetSession(externalID, sessionID string)
SetSession sets session IDs that will be included in all log lines
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger manages logging to file and optionally stderr
func (*Logger) ErrorPrint ¶
ErrorPrint logs an error to file AND prints to stderr for user visibility
func (*Logger) SetAlsoStderr ¶
SetAlsoStderr sets whether to also write to stderr
func (*Logger) SetSession ¶
SetSession sets session IDs that will be included in all log lines. externalID is the Claude Code session ID, sessionID is the Confab backend session ID. Either can be empty if not yet known.
func (*Logger) SetSessionContext ¶
SetSessionContext sets a session context that will be included in all log lines. Pass empty string to clear the context.