Documentation ¶
Index ¶
- Constants
- func DBGetterFactory(_ ...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 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 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 ( // NameFile is unique name of the file logger. NameFile = "FILE" // NameStdOutput is the unique name of the std logger. NameStdOutput = "STD_OUTPUT" // NameDB is the unique name of the DB logger. NameDB = "DB" )
Variables ¶
This section is empty.
Functions ¶
func DBGetterFactory ¶
func DBGetterFactory(_ ...OptionItem) (getter.Interface, error)
DBGetterFactory creates a getter for the DB logger
func DBSweeperFactory ¶
func DBSweeperFactory(options ...OptionItem) (sweeper.Interface, error)
DBSweeperFactory creates DB sweeper.
func FileGetterFactory ¶
func FileGetterFactory(options ...OptionItem) (getter.Interface, error)
FileGetterFactory creates a getter for the "FILE" logger
func FileSweeperFactory ¶
func FileSweeperFactory(options ...OptionItem) (sweeper.Interface, error)
FileSweeperFactory creates file sweeper.
func GetLogDataGetter ¶
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 ¶
GetLoggerName return a logger name by Interface
func GetSweeper ¶
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 HasSweeper ¶
HasSweeper checks if the logger with the name provides a sweeper.
func IsKnownLevel ¶
IsKnownLevel is used to check if the logger level is supported.
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 ¶
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 IsKnownLogger ¶
func IsKnownLogger(name string) (*Declaration, bool)
IsKnownLogger checks if the logger is supported with name.
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry provides unique interfaces on top of multiple logger backends. Entry also implements @Interface.
type Factory ¶
type Factory func(options ...OptionItem) (Interface, error)
Factory creates a new logger based on the settings.
type GetterFactory ¶
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 ¶
func DBFactory(options ...OptionItem) (Interface, error)
DBFactory is factory of file logger
func FileFactory ¶
func FileFactory(options ...OptionItem) (Interface, error)
FileFactory is factory of file logger
func GetLogger ¶
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 ¶
func StdFactory(options ...OptionItem) (Interface, error)
StdFactory is factory of std output logger.
type Option ¶
type Option struct {
// Apply logger option
Apply func(op *options)
}
Option represents settings of the logger
func BackendOption ¶
BackendOption creates option for the specified backend.
func GetterOption ¶
GetterOption creates option for the getter.
type OptionItem ¶
type OptionItem struct {
// contains filtered or unexported fields
}
OptionItem is a simple wrapper of property and value
func (*OptionItem) String ¶
func (o *OptionItem) String() string
String returns the string value of option
type SweeperController ¶
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 ¶
func NewSweeperController(ctx context.Context, sweepers []sweeper.Interface) *SweeperController
NewSweeperController is constructor of controller.
func (*SweeperController) Duration ¶
func (c *SweeperController) Duration() int
Duration = -1 for controller
type SweeperFactory ¶
type SweeperFactory func(options ...OptionItem) (sweeper.Interface, error)
SweeperFactory is responsible for creating a sweeper.Interface based on the settings