Documentation ¶
Overview ¶
Package rpl, the Remote Procedure Logger.
Introduction ¶
RPL is a lite logger utility which supports serialize its Log object, making it easy to show log in remote procedure.
Overview ¶
Here's a typical RPL logging workflow:
--------------------------------------------------------------- | | | | R E M O T E | L O C A L | | | | | Logger ----- Sender ------|--- Receiver ----- FileTarget | | \ | \ | | | \ | \ | | | \ | \ (Write to | | EventLogTarget | FileTarget os.Stdout) | | | | | | | | | | | | (Write to Windows | (Write to log | | Event Log) | file) | | | | ---------------------------------------------------------------
RPL consists of 3 basic types: Log, Target and Source.
- Log transfers as plain old data, between remote and local.
- Target is the output (local) or sender (remote) of Source.
- Source is the log producer (remote), or receiver (local).
Index ¶
- Constants
- type FileTarget
- type Log
- type Logger
- func (logger *Logger) Close()
- func (logger *Logger) Debug(args ...interface{})
- func (logger *Logger) Debugf(format string, args ...interface{})
- func (logger *Logger) Error(args ...interface{})
- func (logger *Logger) Errorf(format string, args ...interface{})
- func (logger *Logger) Fatal(args ...interface{})
- func (logger *Logger) Fatalf(format string, args ...interface{})
- func (logger *Logger) Info(args ...interface{})
- func (logger *Logger) Infof(format string, args ...interface{})
- func (logger *Logger) Log(level int8, args ...interface{})
- func (logger *Logger) Logf(level int8, format string, args ...interface{})
- func (logger *Logger) Logs(level int8, value string)
- func (logger *Logger) Register(target Target)
- func (logger *Logger) Success(args ...interface{})
- func (logger *Logger) Successf(format string, args ...interface{})
- func (logger *Logger) Warn(args ...interface{})
- func (logger *Logger) Warnf(format string, args ...interface{})
- type Receiver
- type Sender
- type Source
- type Target
Constants ¶
View Source
const ( LevelSilent int8 = 0 LevelFatal int8 = 1 LevelError int8 = 1 LevelSuccess int8 = 1 LevelInfo int8 = 2 LevelWarn int8 = 2 LevelDebug int8 = 3 )
Log levels
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileTarget ¶
type FileTarget struct {
// contains filtered or unexported fields
}
FileTarget is Target for os.File. Used for these types and variables:
- os.File
- os.Stdout
- os.Stderr
func NewFileTarget ¶
func NewFileTarget(file *os.File) *FileTarget
func (*FileTarget) Close ¶ added in v0.2.0
func (fileTarget *FileTarget) Close()
func (*FileTarget) Writer ¶
func (fileTarget *FileTarget) Writer() chan<- *Log
type Log ¶
type Log struct { Ch uint16 `json:"ch" mapstructure:"ch"` Level int8 `json:"level" mapstructure:"level"` Value string `json:"value" mapstructure:"value"` }
Log transfers as plain old data, between remote and local.
type Logger ¶
type Logger struct { // [Ch] is the [Log] channel of [Logger]. Ch uint16 // contains filtered or unexported fields }
Logger is the most common Source, produce Log on remote.
type Receiver ¶
type Receiver struct { // ChOffset is the offset of [Log.Ch]. ChOffset uint16 // contains filtered or unexported fields }
Receiver is used to receive Log on local. Acts as a Source.
func NewReceiver ¶
func NewReceiver() *Receiver
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender acts as a Target to send Log from Source to local. Works on remote.
Click to show internal directories.
Click to hide internal directories.