parent
72d39eb216
commit
7f7d29ca1e
30
logger.go
30
logger.go
|
@ -11,14 +11,26 @@ import (
|
|||
|
||||
var (
|
||||
logsClient *Client
|
||||
gserviceName string
|
||||
gserviceType string
|
||||
gserviceName uint8
|
||||
gserviceType uint8
|
||||
grabbitMqLoggingEnabled bool
|
||||
)
|
||||
|
||||
const RabbitMqQueueLogs = "cnj.logs"
|
||||
const (
|
||||
RabbitMqQueueLogs = "cnj.logs"
|
||||
|
||||
func InitLogger(debug bool, colorizedOutput bool, rabbitMqLogging bool, rabbitMqConnAddr string, serviceName string, serviceType string) {
|
||||
ServiceNameAPI = 0
|
||||
ServiceNameMailer = 1
|
||||
ServiceNameStorageServer = 2
|
||||
ServiceNameSSEServer = 3
|
||||
ServiceNameWSServer = 4
|
||||
|
||||
ServiceTypeAlpha = 0
|
||||
ServiceTypeBeta = 1
|
||||
ServiceTypeStable = 2
|
||||
)
|
||||
|
||||
func InitLogger(debug bool, colorizedOutput bool, rabbitMqLogging bool, rabbitMqConnAddr string, serviceName uint8, serviceType uint8) {
|
||||
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
|
||||
|
||||
if debug {
|
||||
|
@ -102,8 +114,8 @@ func LogFatalf(format string, v ...interface{}) {
|
|||
|
||||
type RabbitMqLogMessage struct {
|
||||
MessageType uint8
|
||||
ServiceName string
|
||||
ServiceType string
|
||||
ServiceName uint8
|
||||
ServiceType uint8
|
||||
Msg string
|
||||
Timestamp int64
|
||||
}
|
||||
|
@ -114,9 +126,9 @@ func pushLogMessage(messageType uint8, logMsg string) {
|
|||
}
|
||||
|
||||
rabbitMqLogMessage := RabbitMqLogMessage{
|
||||
MessageType: messageType,
|
||||
ServiceName: gserviceName,
|
||||
ServiceType: gserviceType,
|
||||
MessageType: messageType, // could be debug, info
|
||||
ServiceName: gserviceName, // could be API
|
||||
ServiceType: gserviceType, // could be alpha
|
||||
Msg: logMsg,
|
||||
Timestamp: time.Now().Unix(),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue