github.com/Axway/agent-sdk@v1.1.101/pkg/util/log/definitions.go (about)

     1  package log
     2  
     3  import "github.com/sirupsen/logrus"
     4  
     5  // Create a new instance of the logger
     6  var log = logrus.New()
     7  
     8  // Create a new instance of the metric logger
     9  var metric = logrus.New()
    10  
    11  var usage = logrus.New()
    12  
    13  // LoggingOutput - Defines how the logger will log its output
    14  type LoggingOutput int
    15  
    16  const (
    17  	// STDOUT - logs to the standard output of the agent process
    18  	STDOUT LoggingOutput = iota
    19  	// File - logs to a file, configure file settings for more options
    20  	File
    21  	// Both - logs to stdout and file, see the file confugration settings
    22  	Both
    23  )
    24  
    25  // StringLoggingOutputMap - maps the string value representation of an output type to it's LoggingFormat value
    26  var stringLoggingOutputMap = map[string]LoggingOutput{
    27  	"stdout": STDOUT,
    28  	"file":   File,
    29  	"both":   Both,
    30  }
    31  
    32  // LoggingFormat - Defines the format of the logging output
    33  type LoggingFormat int
    34  
    35  const (
    36  	// Line - logs individual lines, preceded by the timestamp and level
    37  	Line LoggingFormat = iota + 1
    38  	// JSON - logs in JSON format with the timestamp, level, and message all being separate fields
    39  	JSON
    40  )
    41  
    42  // loggingFormatStringMap - maps the LoggingFormat type to it's string representation
    43  var loggingFormatStringMap = map[LoggingFormat]string{
    44  	Line: "line",
    45  	JSON: "json",
    46  }