github.com/blystad/deis@v0.11.0/logger/syslog/priority.go (about)

     1  package syslog
     2  
     3  // Facility represents a message source as defined by RFC 3164.
     4  type Facility byte
     5  
     6  // The following is a list of Facilities as defined by RFC 3164.
     7  const (
     8  	Kern     Facility = iota // kernel messages
     9  	User                     // user-level messages
    10  	Mail                     // mail system
    11  	Daemon                   // system daemons
    12  	Auth                     // security/authorization messages
    13  	Syslog                   // messages internal to syslogd
    14  	Lpr                      // line printer subsystem
    15  	News                     // newtork news subsystem
    16  	Uucp                     // UUCP subsystem
    17  	Cron                     // cron messages
    18  	Authpriv                 // security/authorization messages
    19  	System0                  // historically FTP daemon
    20  	System1                  // historically NTP subsystem
    21  	System2                  // historically log audit
    22  	System3                  // historically log alert
    23  	System4                  // historically clock daemon, some operating systems use this for cron
    24  	Local0                   // local use 0
    25  	Local1                   // local use 1
    26  	Local2                   // local use 2
    27  	Local3                   // local use 3
    28  	Local4                   // local use 4
    29  	Local5                   // local use 5
    30  	Local6                   // local use 6
    31  	Local7                   // local use 7
    32  )
    33  
    34  var facToStr = [...]string{
    35  	"kern",
    36  	"user",
    37  	"mail",
    38  	"daemon",
    39  	"auth",
    40  	"syslog",
    41  	"lpr",
    42  	"news",
    43  	"uucp",
    44  	"cron",
    45  	"authpriv",
    46  	"system0",
    47  	"system1",
    48  	"system2",
    49  	"system3",
    50  	"system4",
    51  	"local0",
    52  	"local1",
    53  	"local2",
    54  	"local3",
    55  	"local4",
    56  	"local5",
    57  	"local6",
    58  	"local7",
    59  }
    60  
    61  // String returns a string representation of the Facility. This satisfies the
    62  // fmt.Stringer interface.
    63  func (f Facility) String() string {
    64  	if f > Local7 {
    65  		return "unknown"
    66  	}
    67  	return facToStr[f]
    68  }
    69  
    70  // Severity represents a level of messsage importance.
    71  type Severity byte
    72  
    73  const (
    74  	// Emerg - system is unusable
    75  	Emerg Severity = iota
    76  	// Alert - immediate action required
    77  	Alert
    78  	// Crit - critical conditions
    79  	Crit
    80  	// Err - error conditions
    81  	Err
    82  	// Warning - warning conditions
    83  	Warning
    84  	// Notice - normal but significant condition
    85  	Notice
    86  	// Info - information message
    87  	Info
    88  	// Debug - debug-level message
    89  	Debug
    90  )
    91  
    92  var sevToStr = [...]string{
    93  	"emerg",
    94  	"alert",
    95  	"crit",
    96  	"err",
    97  	"waining",
    98  	"notice",
    99  	"info",
   100  	"debug",
   101  }
   102  
   103  // String returns a string representation of the Severity. This satisfies the
   104  // fmt.Stringer interface.
   105  func (s Severity) String() string {
   106  	if s > Debug {
   107  		return "unknown"
   108  	}
   109  	return sevToStr[s]
   110  }