Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...interface{})
- func Debugf(str string, args ...interface{})
- func Err(msg string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(str string, args ...interface{})
- func Get() *logrus.Logger
- func Info(args ...interface{})
- func Infof(str string, args ...interface{})
- func Initialize(cfg Options) error
- func Warn(args ...interface{})
- func Warnf(str string, args ...interface{})
- type Options
Constants ¶
const ( //LevelDebug debug level logging, all messages outputted LevelDebug = "DEBUG" //LevelInfo info level logging, no debug information, a lot of info LevelInfo = "INFO" //LevelWarn warning level logging, only recovered errors, and fatal errors LevelWarn = "WARN" //LevelError error level logging, no other information other then fatal errors LevelError = "ERROR" )
Variables ¶
var DefaultOptions = Options{ Path: "", Level: "DEBUG", Usage: true, BlurTimes: 1, ShowAddress: true, }
DefaultOptions holds the default options for LoggingOptions objects
var ErrOptionLevel = errors.New("invalid logging level option provided")
ErrOptionLevel specifies the level field of the LoggingOptions object is invalid
Functions ¶
func Debugf ¶
func Debugf(str string, args ...interface{})
Debugf logs a debug message using formatting like fmt.Printf
func Err ¶
func Err(msg string, args ...interface{})
Err logs an error message from an error object. Uses fmt.Printf for the bulk work, uses the last argument as the error object. Example:
err := someMethod() log.Err("failed on id '%s'", 123, err)
func Errorf ¶
func Errorf(str string, args ...interface{})
Errorf logs an error message using formatting like fmt.Printf
func Infof ¶
func Infof(str string, args ...interface{})
Infof logs an info message using formatting like fmt.Printf
func Initialize ¶
Initialize sets up the logging interface for use without the server
Types ¶
type Options ¶
type Options struct { //Path holds the file path to write logs too. //If this value is empty, then no file writing is //done and only STDOUT will be used Path string `json:"path"` //Level sets the logging level in which only //messages at, or above, this level will be witten. //The values expected are: // DEBUG,INFO,WARN,ERROR //Where the default is INFO Level string `json:"level"` //Usage enables the logging of connection specific //messages Usage bool `json:"usage"` //BlurTimes tells the logging facilities to //round any access time logs to protect //user privacy BlurTimes uint `json:"blurTimes"` //ShowAddress enables the logging of connection //addresses during usage messages ShowAddress bool `json:"showRemoteAddresses"` }
Options holds the configuration settings for the logging operations. This is JSON serializable so we can load from a file.
func CombineOptions ¶
CombineOptions takes a variable amount of LoggingOptions objects and merges them into a single object, taking carefully merging them using LoggingOptions.MergeFrom() method. The starting object is DefaultLoggingOptions, so if no parameters are provided, the defaults are returned. Returns the new object, or an error if the final result does not pass validation. The returned error is the validation error as returned by LoggingOptions.Verify()
func (*Options) MergeFrom ¶
MergeFrom combines the values from the supplied LoggingOptions parameter into this current options. Taking care to only override things needed. Will verify the results and return the object for any validation errors.
Path will only be overriden if the supplied object has one