Documentation
¶
Overview ¶
Package service holds the methods necessary to support implementation of loggers that write to alt4.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LEVEL = struct { INFO uint8 DEBUG uint8 WARNING uint8 ERROR uint8 FATAL uint8 CRITICAL uint8 }{ INFO: 0, DEBUG: 1, WARNING: 2, ERROR: 3, CRITICAL: 4, FATAL: 5, }
var SyncWriter = alt4SyncWriter{}
SyncWriter can be used to override a normal/default go logger to write it's output to alt4 This method writes logs synchronously. Unless you really need to we instead advice on Opening and Closing a group at the end of your routines which will wait for all writes started within the routine to complete Example log.SetOutput(SyncWriter)
var Writer = alt4Writer{}
Writer can be used to override a normal/default go logger to write it's output to alt4 This method writes logs asynchronously. Opening and Closing a group at the end of your routines ensure waits for all writes to finish. Example log.SetOutput(Writer)
Functions ¶
func CloseGroup ¶
func CloseGroup()
func SetAuthToken ¶
func SetAuthToken(token string)
SetAuthToken Used to set the auth token for writing to alt4. This setting can be done via config file ALT4_CONFIG or setting environment variable ALT4_AUTH_TOKEN
func SetDebugOutput ¶
SetDebugOutput Is used to specify where alt4 emits additional output e.g. when facing network errors. Defaults os.Stderr
func SetMode ¶
func SetMode(mode string)
SetMode Sets the behaviour of alt4 based on the following: `release` - Under this mode logs are written to alt4 and not emitted to stdout `debug` - Under this mode logs are written to alt4 and emitted to stdout `testing` - Under this mode logs are not written to alt4, just emitted to stdout `json`(coming soon) - Under this mode all logs are written to a JSON file which you can later upload to alt4 Mode can also be set via a config file ALT4_CONFIG or setting environment variable ALT4_MODE Default mode is `release`
Types ¶
type LogResult ¶
LogResult Object returned when you create a log entry.
type RemoteWriter ¶
type RemoteWriter interface {
// Write function will be called with the Message to be sent to alt4 and an empty R to fill once done
Write(msg *proto.Message, result *LogResult)
}
RemoteWriter an interface for functions called when writing to alt4. You can implement this function to mock writes to alt4 for better testing of your system.
var Alt4RemoteWriter RemoteWriter = writer{}
Alt4RemoteWriter For testing purposes, implement your own RemoteWriter and equate it to this variable