cli/pkg/cli/log.go
Snider bf53270631 refactor(cli): replace stdlib imports with core/go primitives
Replace fmt, errors, path/filepath, strings, and strconv usages with
core/go equivalents where available. Fully removes "errors" and
"path/filepath" imports. Retains fmt (Fprint/Fprintf/Fscanln/Sscanf/Stringer),
strings (Builder/Repeat/LastIndex/NewReplacer/FieldsSeq/SplitSeq), and
strconv (Atoi/ParseUint) where core/go has no equivalent.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 11:08:02 +01:00

49 lines
1.4 KiB
Go

package cli
import (
"dappco.re/go/core"
"dappco.re/go/core/log"
)
// LogLevel aliases for convenience.
type LogLevel = log.Level
const (
LogLevelQuiet = log.LevelQuiet
LogLevelError = log.LevelError
LogLevelWarn = log.LevelWarn
LogLevelInfo = log.LevelInfo
LogLevelDebug = log.LevelDebug
)
// LogDebug logs a debug message if the default logger is available.
//
// cli.LogDebug("cache miss", "key", cacheKey)
func LogDebug(msg string, keyvals ...any) { log.Debug(msg, keyvals...) }
// LogInfo logs an info message.
//
// cli.LogInfo("configuration reloaded", "path", configPath)
func LogInfo(msg string, keyvals ...any) { log.Info(msg, keyvals...) }
// LogWarn logs a warning message.
//
// cli.LogWarn("GitHub CLI not authenticated", "user", username)
func LogWarn(msg string, keyvals ...any) { log.Warn(msg, keyvals...) }
// LogError logs an error message.
//
// cli.LogError("Fatal error", "err", err)
func LogError(msg string, keyvals ...any) { log.Error(msg, keyvals...) }
// LogSecurity logs a security-sensitive message.
//
// cli.LogSecurity("login attempt", "user", "admin")
func LogSecurity(msg string, keyvals ...any) { log.Security(msg, keyvals...) }
// LogSecurityf logs a formatted security-sensitive message.
//
// cli.LogSecurityf("login attempt from %s", username)
func LogSecurityf(format string, args ...any) {
log.Security(core.Sprintf(format, args...))
}