Documentation ¶
Index ¶
- Constants
- func CInfo(ctx context.Context, msg string, keysAndValues ...any)
- func InitConsoleLogger(moduleName string, logLevel int, isJson bool, moduleVersion string) error
- func InitLoggerFromConfig(loggerPrefixName, moduleName string, sdkType, platformName string, ...) error
- func SDKLog(ctx context.Context, logLevel int, file string, line int, msg string, ...)
- func ZDebug(ctx context.Context, msg string, keysAndValues ...any)
- func ZError(ctx context.Context, msg string, err error, keysAndValues ...any)
- func ZInfo(ctx context.Context, msg string, keysAndValues ...any)
- func ZPanic(ctx context.Context, msg string, err interface{}, keysAndValues ...any)
- func ZWarn(ctx context.Context, msg string, err error, keysAndValues ...any)
- type Color
- type LogFormatter
- type Logger
- type SqlLogger
- func (SqlLogger) Error(ctx context.Context, msg string, args ...any)
- func (SqlLogger) Info(ctx context.Context, msg string, args ...any)
- func (l *SqlLogger) LogMode(logLevel gormLogger.LogLevel) gormLogger.Interface
- func (l *SqlLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (SqlLogger) Warn(ctx context.Context, msg string, args ...any)
- type ZapLogger
- func (l *ZapLogger) Debug(ctx context.Context, msg string, keysAndValues ...any)
- func (l *ZapLogger) Error(ctx context.Context, msg string, err error, keysAndValues ...any)
- func (l *ZapLogger) Info(ctx context.Context, msg string, keysAndValues ...any)
- func (l *ZapLogger) Panic(ctx context.Context, msg string, r interface{}, keysAndValues ...any)
- func (l *ZapLogger) ToZap() *zap.SugaredLogger
- func (l *ZapLogger) Warn(ctx context.Context, msg string, err error, keysAndValues ...any)
- func (l *ZapLogger) WithCallDepth(depth int) Logger
- func (l *ZapLogger) WithName(name string) Logger
- func (l *ZapLogger) WithValues(keysAndValues ...any) Logger
- type ZkLogger
Constants ¶
View Source
const ( LevelFatal = iota LevelPanic LevelError LevelWarn LevelInfo LevelDebug LevelDebugWithSQL )
Variables ¶
This section is empty.
Functions ¶
func InitConsoleLogger ¶
InitConsoleLogger init osStdout and osStderr.
func InitLoggerFromConfig ¶
func InitLoggerFromConfig( loggerPrefixName, moduleName string, sdkType, platformName string, logLevel int, isStdout bool, isJson bool, logLocation string, rotateCount uint, rotationTime uint, moduleVersion string, isSimplify bool, ) error
InitFromConfig initializes a Zap-based logger.
Types ¶
type LogFormatter ¶
type LogFormatter interface {
Format() any
}
type Logger ¶
type Logger interface { // Debug logs a message at the debug level including any supplementary key-value pairs. // Useful for detailed output for debugging purposes. Debug(ctx context.Context, msg string, keysAndValues ...any) // Info logs a message at the info level along with any supplementary key-value pairs. // Ideal for general operational messages that inform about the system's state. Info(ctx context.Context, msg string, keysAndValues ...any) // Warn logs a message at the warning level, indicating potential issues in the system. // It includes an error object and any supplementary key-value pairs. Warn(ctx context.Context, msg string, err error, keysAndValues ...any) // Error logs a message at the error level, indicating serious problems that need attention. // It includes an error object and any supplementary key-value pairs. Error(ctx context.Context, msg string, err error, keysAndValues ...any) // Panic logs a message at the panic level, indicating a critical error like nil pointer exception that requires immediate attention. // It includes an error object and any supplementary key-value pairs. Panic(ctx context.Context, msg string, r interface{}, keysAndValues ...any) // WithValues returns a new Logger instance that will include the specified key-value pairs // in all subsequent log messages. Useful for adding consistent context to a series of logs. WithValues(keysAndValues ...any) Logger // WithName returns a new Logger instance prefixed with the specified name. // This is helpful for distinguishing logs generated from different sources or components. WithName(name string) Logger // WithCallDepth returns a new Logger instance that adjusts the call depth for identifying // the source of log messages. Useful in wrapper or middleware layers to maintain accurate log source information. WithCallDepth(depth int) Logger }
type SqlLogger ¶
type SqlLogger struct { LogLevel gormLogger.LogLevel IgnoreRecordNotFoundError bool SlowThreshold time.Duration }
func NewSqlLogger ¶
func (*SqlLogger) LogMode ¶
func (l *SqlLogger) LogMode(logLevel gormLogger.LogLevel) gormLogger.Interface
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
func NewConsoleZapLogger ¶
func NewZapLogger ¶
func (*ZapLogger) ToZap ¶
func (l *ZapLogger) ToZap() *zap.SugaredLogger
func (*ZapLogger) WithCallDepth ¶
func (*ZapLogger) WithValues ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.
|
package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify. |
Click to show internal directories.
Click to hide internal directories.