Documentation ¶
Index ¶
- Constants
- func DBGetterFactory(options ...OptionItem) (getter.Interface, error)
- func DBSweeperFactory(options ...OptionItem) (sweeper.Interface, error)
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func FileGetterFactory(options ...OptionItem) (getter.Interface, error)
- func FileSweeperFactory(options ...OptionItem) (sweeper.Interface, error)
- func GetLogDataGetter(loggerOptions ...Option) (getter.Interface, error)
- func GetLoggerName(l Interface) string
- func GetSweeper(context context.Context, sweeperOptions ...Option) (sweeper.Interface, error)
- func HasGetter(name string) bool
- func HasLogGetterConfigured() bool
- func HasSweeper(name string) bool
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Init(ctx context.Context) error
- func IsKnownLevel(level string) bool
- func IsKnownLogger(name string) bool
- func Retrieve(logID string) ([]byte, error)
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- type Closer
- type Declaration
- type Entry
- func (e *Entry) Close() error
- func (e *Entry) Debug(v ...interface{})
- func (e *Entry) Debugf(format string, v ...interface{})
- func (e *Entry) Error(v ...interface{})
- func (e *Entry) Errorf(format string, v ...interface{})
- func (e *Entry) Fatal(v ...interface{})
- func (e *Entry) Fatalf(format string, v ...interface{})
- func (e *Entry) Info(v ...interface{})
- func (e *Entry) Infof(format string, v ...interface{})
- func (e *Entry) Warning(v ...interface{})
- func (e *Entry) Warningf(format string, v ...interface{})
- type Factory
- type GetterFactory
- type Interface
- type Option
- type OptionItem
- type SweeperController
- type SweeperFactory
Constants ¶
const ( // LoggerNameFile is unique name of the file logger. LoggerNameFile = "FILE" // LoggerNameStdOutput is the unique name of the std logger. LoggerNameStdOutput = "STD_OUTPUT" // LoggerNameDB is the unique name of the DB logger. LoggerNameDB = "DB" )
Variables ¶
This section is empty.
Functions ¶
func DBGetterFactory ¶ added in v1.7.0
func DBGetterFactory(options ...OptionItem) (getter.Interface, error)
DBGetterFactory creates a getter for the DB logger
func DBSweeperFactory ¶ added in v1.7.0
func DBSweeperFactory(options ...OptionItem) (sweeper.Interface, error)
DBSweeperFactory creates DB sweeper.
func FileGetterFactory ¶ added in v1.7.0
func FileGetterFactory(options ...OptionItem) (getter.Interface, error)
FileGetterFactory creates a getter for the "FILE" logger
func FileSweeperFactory ¶ added in v1.7.0
func FileSweeperFactory(options ...OptionItem) (sweeper.Interface, error)
FileSweeperFactory creates file sweeper.
func GetLogDataGetter ¶ added in v1.7.0
GetLogDataGetter return the 1st matched log data getter interface
loggerOptions ...Option : logger options
If failed,
configured but initialize failed: a nil log data getter and a non-nil error will be returned. no getter configured: a nil log data getter with a nil error are returned
Otherwise, a non nil log data getter is returned with nil error.
func GetLoggerName ¶ added in v1.7.0
GetLoggerName return a logger name by Interface
func GetSweeper ¶ added in v1.7.0
GetSweeper gets an unified sweeper controller for sweeping purpose.
context context.Context : system contex used to control the sweeping loops sweeperOptions ...Option : sweeper options
If failed, a nil sweeper and a non-nil error will be returned. Otherwise, a non nil sweeper is returned with nil error.
func HasGetter ¶ added in v1.7.0
HasGetter checks if the logger with the name provides a log data getter.
func HasLogGetterConfigured ¶ added in v1.7.0
func HasLogGetterConfigured() bool
HasLogGetterConfigured checks if a log data getter is there for using
func HasSweeper ¶ added in v1.7.0
HasSweeper checks if the logger with the name provides a sweeper.
func IsKnownLevel ¶ added in v1.7.0
IsKnownLevel is used to check if the logger level is supported.
func IsKnownLogger ¶ added in v1.7.0
IsKnownLogger checks if the logger is supported with name.
Types ¶
type Closer ¶
type Closer interface { // Close the opened io stream Close() error }
Closer defines method to close the open io stream used by logger.
type Declaration ¶ added in v1.7.0
type Declaration struct { Logger Factory Sweeper SweeperFactory Getter GetterFactory // Indicate if the logger is a singleton logger Singleton bool }
Declaration is used to declare a supported logger. Use this declaration to indicate what logger and sweeper will be provided.
func KnownLoggers ¶ added in v1.7.0
func KnownLoggers(name string) *Declaration
KnownLoggers return the declaration by the name
type Entry ¶ added in v1.7.0
type Entry struct {
// contains filtered or unexported fields
}
Entry provides unique interfaces on top of multiple logger backends. Entry also implements @Interface.
type Factory ¶ added in v1.7.0
type Factory func(options ...OptionItem) (Interface, error)
Factory creates a new logger based on the settings.
type GetterFactory ¶ added in v1.7.0
type GetterFactory func(options ...OptionItem) (getter.Interface, error)
GetterFactory is responsible for creating a log data getter based on the options
type Interface ¶
type Interface interface { // For debuging Debug(v ...interface{}) // For debuging with format Debugf(format string, v ...interface{}) // For logging info Info(v ...interface{}) // For logging info with format Infof(format string, v ...interface{}) // For warning Warning(v ...interface{}) // For warning with format Warningf(format string, v ...interface{}) // For logging error Error(v ...interface{}) // For logging error with format Errorf(format string, v ...interface{}) // For fatal error Fatal(v ...interface{}) // For fatal error with error Fatalf(format string, v ...interface{}) }
Interface for logger.
func DBFactory ¶ added in v1.7.0
func DBFactory(options ...OptionItem) (Interface, error)
DBFactory is factory of file logger
func FileFactory ¶ added in v1.7.0
func FileFactory(options ...OptionItem) (Interface, error)
FileFactory is factory of file logger
func GetLogger ¶ added in v1.7.0
GetLogger gets an unified logger entry for logging per the passed settings. The logger may built based on the multiple registered logger backends.
loggerOptions ...Option : logger options
If failed, a nil logger and a non-nil error will be returned. Otherwise, a non nil logger is returned with nil error.
func StdFactory ¶ added in v1.7.0
func StdFactory(options ...OptionItem) (Interface, error)
StdFactory is factory of std output logger.
type Option ¶ added in v1.7.0
type Option struct {
// Apply logger option
Apply func(op *options)
}
Option represents settings of the logger
func BackendOption ¶ added in v1.7.0
BackendOption creates option for the specified backend.
func GetterOption ¶ added in v1.7.0
GetterOption creates option for the getter.
type OptionItem ¶ added in v1.7.0
type OptionItem struct {
// contains filtered or unexported fields
}
OptionItem is a simple wrapper of property and value
func (*OptionItem) Field ¶ added in v1.7.0
func (o *OptionItem) Field() string
Field returns name of the option
func (*OptionItem) Int ¶ added in v1.7.0
func (o *OptionItem) Int() int
Int returns the integer value of option
func (*OptionItem) Raw ¶ added in v1.7.0
func (o *OptionItem) Raw() interface{}
Raw returns the raw value
func (*OptionItem) String ¶ added in v1.7.0
func (o *OptionItem) String() string
String returns the string value of option
type SweeperController ¶ added in v1.7.0
type SweeperController struct {
// contains filtered or unexported fields
}
SweeperController is an unified sweeper entry and built on top of multiple sweepers. It's responsible for starting the configured sweepers.
func NewSweeperController ¶ added in v1.7.0
func NewSweeperController(ctx context.Context, sweepers []sweeper.Interface) *SweeperController
NewSweeperController is constructor of controller.
func (*SweeperController) Duration ¶ added in v1.7.0
func (c *SweeperController) Duration() int
Duration = -1 for controller
func (*SweeperController) Sweep ¶ added in v1.7.0
func (c *SweeperController) Sweep() (int, error)
Sweep logs
type SweeperFactory ¶ added in v1.7.0
type SweeperFactory func(options ...OptionItem) (sweeper.Interface, error)
SweeperFactory is responsible for creating a sweeper.Interface based on the settings