Documentation ¶
Index ¶
- Constants
- type KeyNamesConfig
- type LogEntry
- func (entry *LogEntry) WithCategorisedEvent(eventName, eventCategory, eventMsg, tid string) *LogEntry
- func (entry *LogEntry) WithError(err error) *LogEntry
- func (entry *LogEntry) WithField(key string, value interface{}) *LogEntry
- func (entry *LogEntry) WithFields(fields map[string]interface{}) *LogEntry
- func (entry *LogEntry) WithMonitoringEvent(eventName, tid, contentType string) *LogEntry
- func (entry *LogEntry) WithTime(time time.Time) *LogEntry
- func (entry *LogEntry) WithTransactionID(tid string) *LogEntry
- func (entry *LogEntry) WithUUID(uuid string) *LogEntry
- func (entry *LogEntry) WithValidFlag(isValid bool) *LogEntry
- type UPPLogger
- func (ulog *UPPLogger) LogServiceStartedEvent(port int)
- func (ulog *UPPLogger) WithCategorisedEvent(eventName, eventCategory, eventMsg, tid string) *LogEntry
- func (ulog *UPPLogger) WithError(err error) *LogEntry
- func (ulog *UPPLogger) WithField(key string, value interface{}) *LogEntry
- func (ulog *UPPLogger) WithFields(fields map[string]interface{}) *LogEntry
- func (ulog *UPPLogger) WithMonitoringEvent(eventName, tid, contentType string) *LogEntry
- func (ulog *UPPLogger) WithTime(time time.Time) *LogEntry
- func (ulog *UPPLogger) WithTransactionID(tid string) *LogEntry
- func (ulog *UPPLogger) WithUUID(uuid string) *LogEntry
- func (ulog *UPPLogger) WithValidFlag(isValid bool) *LogEntry
Constants ¶
const ( DefaultKeyLogLevel = logrus.FieldKeyLevel DefaultKeyMsg = logrus.FieldKeyMsg DefaultKeyError = "error" DefaultKeyTime = "time" DefaultKeyServiceName = "service_name" DefaultKeyTransactionID = "transaction_id" DefaultKeyUUID = "uuid" DefaultKeyIsValid = "isValid" DefaultKeyEventName = "event" DefaultKeyMonitoringEvent = "monitoring_event" DefaultKeyContentType = "content_type" DefaultKeyEventCategory = "event_category" DefaultKeyEventMsg = "event_msg" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyNamesConfig ¶
type KeyNamesConfig struct { KeyLogLevel string KeyMsg string KeyError string KeyTime string KeyServiceName string KeyTransactionID string KeyUUID string KeyIsValid string KeyEventName string KeyMonitoringEvent string KeyContentType string KeyEventCategory string KeyEventMsg string }
func GetDefaultKeyNamesConfig ¶
func GetDefaultKeyNamesConfig() *KeyNamesConfig
func GetFullKeyNameConfig ¶
func GetFullKeyNameConfig(conf KeyNamesConfig) *KeyNamesConfig
GetFullKeyNameConfig returns KeyNamesConfig that has all key names from the input conf and if there are key names missing from the input conf, the default key names are used.
type LogEntry ¶
LogEntry is wrapper around logrus.Entry with a few methods adding UPP specific keys to the log entries. LogEntry is the final or intermediate logging entry. It's finally logged when Debug, Info, Warn, Error, Fatal or Panic is called on it.
func (*LogEntry) WithCategorisedEvent ¶
func (entry *LogEntry) WithCategorisedEvent(eventName, eventCategory, eventMsg, tid string) *LogEntry
WithCategorisedEvent returns new LogEntry with categorised event fields in it. The categorised event fields are event name, event category, event message.
func (*LogEntry) WithField ¶
WithField for LogEntry is wrapper around WithField of logrus.Entry that let us return our object when chaining the calls to WithField.
func (*LogEntry) WithFields ¶
WithFields for LogEntry is wrapper around WithFields of logrus.Entry that let us return our object when chaining the calls to WithFields.
func (*LogEntry) WithMonitoringEvent ¶
WithMonitoringEvent returns new LogEntry with monitoring event fields in it. The monitoring event fields are boolean valued monitoring event, event name and content type.
func (*LogEntry) WithTransactionID ¶
WithTransactionID returns new LogEntry with transaction id field in it.
func (*LogEntry) WithValidFlag ¶
WithValidFlag returns new LogEntry with "is valid" field in it.
type UPPLogger ¶
UPPLogger wraps logrus logger providing the same functionality as logrus with a few UPP specifics.
func NewUPPInfoLogger ¶
func NewUPPInfoLogger(serviceName string, kconf ...KeyNamesConfig) *UPPLogger
NewUPPInfoLogger initializes UPPLogger with log level INFO.
func NewUPPLogger ¶
func NewUPPLogger(serviceName string, logLevel string, kconf ...KeyNamesConfig) *UPPLogger
NewUPPLogger initializes UPP logger with structured logging format.
func NewUnstructuredLogger ¶
func NewUnstructuredLogger() *UPPLogger
NewUnstructuredLogger initializes plain logrus log without taking into account UPP log formatting.
func (*UPPLogger) LogServiceStartedEvent ¶
LogServiceStartedEvent logs service started event with level INFO.
func (*UPPLogger) WithCategorisedEvent ¶
func (ulog *UPPLogger) WithCategorisedEvent(eventName, eventCategory, eventMsg, tid string) *LogEntry
WithCategorisedEvent creates an entry from the standard logger and adds categorised event fields to it. The added fields are "event", "event_category" and "event_msg".
func (*UPPLogger) WithError ¶
WithError creates an entry from the standard logger and adds an error field to it.
func (*UPPLogger) WithField ¶
WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func (*UPPLogger) WithFields ¶
WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func (*UPPLogger) WithMonitoringEvent ¶
WithMonitoringEvent creates an entry from the standard logger and adds monitoring event fields to it. The monitoring event fields are "monitoring_event", "event" and "content_type".
func (*UPPLogger) WithTime ¶
WithTime creates an entry from the standard logger and adds an time field to it.
func (*UPPLogger) WithTransactionID ¶
WithTransactionID creates an entry from the standard logger and adds transaction_id field to it.
func (*UPPLogger) WithUUID ¶
WithUUID creates an entry from the standard logger and adds an uuid field to it.
func (*UPPLogger) WithValidFlag ¶
WithValidFlag creates an entry from the standard logger and adds an "is valid" field to it.