github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/log/event-helpers.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package log
     4  
     5  import (
     6  	"github.com/GeniusesGroup/libgo/protocol"
     7  )
     8  
     9  func NewEvent(level protocol.LogType, domain, message string) (event *Event) {
    10  	var e Event
    11  	e.Init(level, domain, message, false)
    12  	return &e
    13  }
    14  
    15  func TraceEvent(level protocol.LogType, domain, message string) (event *Event) {
    16  	var e Event
    17  	e.Init(level, domain, message, true)
    18  	return &e
    19  }
    20  
    21  func InfoEvent(domain, message string) (event *Event) {
    22  	var e Event
    23  	e.Init(protocol.LogEvent_Information, domain, message, false)
    24  	return &e
    25  }
    26  
    27  func NoticeEvent(domain, message string) (event *Event) {
    28  	var e Event
    29  	e.Init(protocol.LogEvent_Notice, domain, message, false)
    30  	return &e
    31  }
    32  
    33  func DebugEvent(domain, message string) (event *Event) {
    34  	var e Event
    35  	e.Init(protocol.LogEvent_Debug, domain, message, false)
    36  	return &e
    37  }
    38  
    39  func DeepDebugEvent(domain, message string) (event *Event) {
    40  	var e Event
    41  	e.Init(protocol.LogEvent_DeepDebug, domain, message, false)
    42  	return &e
    43  }
    44  
    45  func WarnEvent(domain, message string) (event *Event) {
    46  	var e Event
    47  	e.Init(protocol.LogEvent_Warning, domain, message, false)
    48  	return &e
    49  }
    50  
    51  // FatalEvent return new event with panic level and added stack trace.
    52  func PanicEvent(domain, message string) (event *Event) {
    53  	var e Event
    54  	e.Init(protocol.LogEvent_Panic, domain, message, true)
    55  	return &e
    56  }
    57  
    58  // FatalEvent return new event with fatal level and added stack trace.
    59  func FatalEvent(domain, message string) (event *Event) {
    60  	var e Event
    61  	e.Init(protocol.LogEvent_Fatal, domain, message, true)
    62  	return &e
    63  }
    64  
    65  // ConfEvent return new event with "Confidential" level
    66  func ConfEvent(domain, message string) (event *Event) {
    67  	var e Event
    68  	e.Init(protocol.LogEvent_Confidential, domain, message, false)
    69  	return &e
    70  }