Documentation
ΒΆ
Index ΒΆ
- Variables
- func Context(ctx context.Context) *request
- func Debug(i ...interface{})
- func Debugf(format string, i ...interface{})
- func Error(i ...interface{})
- func Errorf(format string, i ...interface{})
- func Fatal(i ...interface{})
- func Fatalf(msg string, i ...interface{})
- func GetCaller(level string, skip int) string
- func Info(i ...interface{})
- func Infof(format string, i ...interface{})
- func Init()
- func InitWithConfig(cfg Config)
- func NewRequest() *request
- func Tracing(processId, url, method string, resCode int, resPayload []byte, ...)
- func Warn(i ...interface{})
- func Warnf(format string, i ...interface{})
- type Config
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var ( DefaultLogConfig = Config{ LogToTerminal: true, Location: "/log/", FileLogName: "server_log", FileFormat: ".%Y-%b-%d-%H-%M.log", MaxAge: 30, RotationFile: 24, UseStackTrace: false, } )
Functions ΒΆ
func GetCaller ΒΆ
GetCaller return trimmed location of the file who call the log function example project_name/usecase/user.go:34
func InitWithConfig ΒΆ
func InitWithConfig(cfg Config)
func NewRequest ΒΆ
func NewRequest() *request
NewRequest will create new log data model for incoming request
Types ΒΆ
type Config ΒΆ
type Config struct { LogToTerminal bool // Highly recommended disable in production server. Default true. Location string // Location file log will be save. Default "project_directory/log/". FileLogName string // File log name. Default "server_log". FileFormat string // Default "FileLogName.2021-Oct-22-00-00.log" MaxAge int // Days before deleting log file. Default 30 days. RotationFile int // Hour before creating new file. Default 24 hour. UseStackTrace bool // Print stack trace to log file. Default false. }
Click to show internal directories.
Click to hide internal directories.