planetmint-go/util/logger.go
Jürgen Eckel 2ee9be36dc
Added logger a logger struct to log with a TAG (#198)
* added util.looger struct and methods
* extended the logging

---------

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-11-27 14:47:03 +01:00

32 lines
733 B
Go

package util
import sdk "github.com/cosmos/cosmos-sdk/types"
type AppLogger struct {
}
var globalApplicationLoggerTag string
func init() {
// Initialize the package-level variable
globalApplicationLoggerTag = "[app] "
}
func GetAppLogger() *AppLogger {
return &AppLogger{}
}
func (logger *AppLogger) Info(ctx sdk.Context, msg string, keyvals ...interface{}) {
ctx.Logger().Info(globalApplicationLoggerTag+msg, keyvals)
}
func (logger *AppLogger) Debug(ctx sdk.Context, msg string, keyvals ...interface{}) {
ctx.Logger().Debug(globalApplicationLoggerTag+msg, keyvals)
}
func (logger *AppLogger) Error(ctx sdk.Context, msg string, keyvals ...interface{}) {
ctx.Logger().Error(globalApplicationLoggerTag+msg, keyvals)
}