Code formatting
This commit is contained in:
parent
ef8bd6ac1f
commit
4d15e59d4c
41 changed files with 472 additions and 475 deletions
|
@ -1,11 +1,11 @@
|
|||
package elektronLogging
|
||||
|
||||
import (
|
||||
"time"
|
||||
"fmt"
|
||||
"strconv"
|
||||
. "github.com/spdfg/elektron/elektronLogging/types"
|
||||
"fmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
. "github.com/spdfg/elektron/elektronLogging/types"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
var config LoggerConfig
|
||||
|
@ -14,25 +14,25 @@ var formatter ElektronFormatter
|
|||
|
||||
func BuildLogger() *LoggerImpl {
|
||||
|
||||
// read configuration from yaml
|
||||
// read configuration from yaml
|
||||
config.GetConfig()
|
||||
|
||||
// create the log directory
|
||||
|
||||
// create the log directory
|
||||
startTime := time.Now()
|
||||
formatter.TimestampFormat = "2006-01-02 15:04:05"
|
||||
GetLogDir(startTime, "_")
|
||||
|
||||
prefix := fmt.Sprintf("_%d%d%s%s%s%s",startTime.Year(), startTime.Month(),strconv.Itoa(startTime.Day()),
|
||||
strconv.Itoa(startTime.Hour()),strconv.Itoa(startTime.Minute()),strconv.Itoa(startTime.Second()))
|
||||
|
||||
//create a single logrus instance and set its formatter to ElektronFormatter
|
||||
prefix := fmt.Sprintf("_%d%d%s%s%s%s", startTime.Year(), startTime.Month(), strconv.Itoa(startTime.Day()),
|
||||
strconv.Itoa(startTime.Hour()), strconv.Itoa(startTime.Minute()), strconv.Itoa(startTime.Second()))
|
||||
|
||||
//create a single logrus instance and set its formatter to ElektronFormatter
|
||||
logger = log.New()
|
||||
logger.SetFormatter(&formatter)
|
||||
|
||||
// create a chain of loggers
|
||||
// create a chain of loggers
|
||||
head := new(LoggerImpl)
|
||||
cLog := NewConsoleLogger(CONSOLE,prefix)
|
||||
pLog := NewPcpLogger(PCP,prefix)
|
||||
cLog := NewConsoleLogger(CONSOLE, prefix)
|
||||
pLog := NewPcpLogger(PCP, prefix)
|
||||
schedTraceLog := NewSchedTraceLogger(SCHED_TRACE, prefix)
|
||||
spsLog := NewSchedPolicySwitchLogger(SPS, prefix)
|
||||
schedWindowLog := NewSchedWindowLogger(SCHED_WINDOW, prefix)
|
||||
|
|
Reference in a new issue