Documentation ¶
Overview ¶
Created from https://github.com/nkmr-jp/go-logger-scaffold
Created from https://github.com/nkmr-jp/go-logger-scaffold
Created from https://github.com/nkmr-jp/go-logger-scaffold
Created from https://github.com/nkmr-jp/go-logger-scaffold
Created from https://github.com/nkmr-jp/go-logger-scaffold
Index ¶
- func Debug(msg string, fields ...zap.Field)
- func Debugf(msg string, err error, fields ...zap.Field)
- func Dump(i interface{})
- func Error(msg string, fields ...zap.Field)
- func Errorf(msg string, err error, fields ...zap.Field)
- func Fatal(msg string, fields ...zap.Field)
- func Fatalf(msg string, err error, fields ...zap.Field)
- func GetVersion(versionType VersionType) *stringdeprecated
- func Info(msg string, fields ...zap.Field)
- func Infof(msg string, err error, fields ...zap.Field)
- func InitLogger() *zap.Logger
- func Print(i interface{}) (n int, err error)
- func Println(i interface{}) (n int, err error)
- func SetConsoleField(fieldKey ...string)
- func SetConsoleType(option ConsoleType)
- func SetLogFile(file string)
- func SetLogLevel(option zapcore.Level)
- func SetLogLevelByString(levelStr string)
- func SetOutputType(option OutputType)
- func SetOutputTypeByString(outputTypeStr string)
- func SetPurgeTime(duration time.Duration)
- func SetRepositoryCallerEncoder(urlFormat, revisionOrTag, srcRootDir string)
- func SetRotationTime(duration time.Duration)
- func SetVersion(revisionOrTag string)
- func Sync()
- func SyncWhenStop()
- func Warn(msg string, fields ...zap.Field)
- func Warnf(msg string, err error, fields ...zap.Field)
- type ConsoleType
- type OutputType
- type VersionTypedeprecated
- type Wrapper
- func (w *Wrapper) Debug(msg string, fields ...zap.Field)
- func (w *Wrapper) Debugf(msg string, err error, fields ...zap.Field)
- func (w *Wrapper) Error(msg string, fields ...zap.Field)
- func (w *Wrapper) Errorf(msg string, err error, fields ...zap.Field)
- func (w *Wrapper) Fatal(msg string, fields ...zap.Field)
- func (w *Wrapper) Fatalf(msg string, err error, fields ...zap.Field)
- func (w *Wrapper) Info(msg string, fields ...zap.Field)
- func (w *Wrapper) Infof(msg string, err error, fields ...zap.Field)
- func (w *Wrapper) Warn(msg string, fields ...zap.Field)
- func (w *Wrapper) Warnf(msg string, err error, fields ...zap.Field)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug is Wrapper of Zap's Debug. Outputs a short log to the console. Detailed json log output to log file.
func GetVersion
deprecated
func GetVersion(versionType VersionType) *string
GetVersionFromGit use the git revision or tag as a version. When using tag, recommend semantic versioning. See https://semver.org/
Deprecated: it will be removed in the next major version upgrade.
func InitLogger ¶
Initialize the Logger. Outputs short logs to the console and Write structured and detailed json logs to the log file.
func SetConsoleField ¶
func SetConsoleField(fieldKey ...string)
SetConsoleField Set the fields to be displayed in the console.
func SetConsoleType ¶
func SetConsoleType(option ConsoleType)
func SetLogFile ¶
func SetLogFile(file string)
SetLogFile set log file path ex. "./log/app_%Y-%m-%d.log"
func SetLogLevel ¶
func SetLogLevelByString ¶
func SetLogLevelByString(levelStr string)
SetLogLevelByString is set log level. levelStr can use (DEBUG,INFO,WARN,ERROR,FATAL).
func SetOutputType ¶
func SetOutputType(option OutputType)
func SetOutputTypeByString ¶
func SetOutputTypeByString(outputTypeStr string)
SetOutputTypeByString outputTypeStr can use (SimpleConsoleAndFile, ConsoleAndFile, Console, File).
func SetPurgeTime ¶
func SetRepositoryCallerEncoder ¶
func SetRepositoryCallerEncoder(urlFormat, revisionOrTag, srcRootDir string)
SetRepositoryCallerEncoder build and set CallerEncoder that build a link to the Repository of the caller's source code.
func SetRotationTime ¶
func SetVersion ¶
func SetVersion(revisionOrTag string)
SetVersion set version. note: `revisionOrTag` should be a git revision or a tag. ex. `e86b9a7` or `v1.0.0`.
func SyncWhenStop ¶
func SyncWhenStop()
SyncWhenStop flush log buffer. when interrupt or terminated.
Types ¶
type ConsoleType ¶
type ConsoleType int
const ( ConsoleTypeAll ConsoleType = iota ConsoleTypeError ConsoleTypeNone )
type OutputType ¶
type OutputType int
const ( // OutputTypeShortConsoleAndFile output simple console log and detail file log (default) OutputTypeShortConsoleAndFile OutputType = iota // OutputTypeConsoleAndFile output detail console log and file log OutputTypeConsoleAndFile // OutputTypeConsole output detail console log OutputTypeConsole // OutputTypeFile output detail file log OutputTypeFile )
func (OutputType) String ¶
func (o OutputType) String() string
type VersionType
deprecated
type VersionType int
Deprecated: it will be removed in the next major version upgrade.
const ( // Deprecated: it will be removed in the next major version upgrade. VersionTypeRevision VersionType = iota // Deprecated: it will be removed in the next major version upgrade. VersionTypeTag )
type Wrapper ¶
func NewWrapper ¶
NewWrapper can additional fields. ex. Use this when you want to add a common value in the scope of a context, such as an API request.