WIP : Elektron Logging library #16
|
@ -26,8 +26,8 @@ import (
|
|||
![]() Okay. Done Okay. Done
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
"github.com/mash/gokmeans"
|
||||
"github.com/montanaflynn/stats"
|
||||
log "github.com/sirupsen/logrus"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
)
|
||||
|
||||
// Information about a cluster of tasks.
|
||||
|
@ -52,7 +52,7 @@ func (tc TasksToClassify) taskObservationCalculator(task Task) []float64 {
|
|||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
} else if task.Watts != 0.0 {
|
||||
return []float64{task.Watts}
|
||||
} else {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.FatalLevel, "Unable to classify tasks. Missing Watts or ClassToWatts attribute in workload")
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
elekLog.Log(CONSOLE, log.FatalLevel, "Unable to classify tasks. Missing Watts or ClassToWatts attribute in workload")
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
return []float64{0.0} // Won't reach here.
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func clusterSizeAvgMMMPU(tasks []Task, taskObservation func(task Task) []float64
|
|||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
} else {
|
||||
![]() Is Logf an option here instead of sprinting? Is Logf an option here instead of sprinting?
![]() Replace Replace `elekLogT.ERROR` with `elekLogT.CONSOLE`.
![]()
`err.Error()` returns the string representation.
![]() Yes. I will work on implementing Logf() Yes. I will work on implementing Logf()
![]() Done Done
![]() Okay. Will do the change Okay. Will do the change
|
||||
// skip this value
|
||||
// there is an error in the task config.
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.ErrorLevel, err.Error())
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
elekLog.Log(CONSOLE, log.ErrorLevel, err.Error())
|
||||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
||||
}
|
||||
} else {
|
||||
// There is only one observation for the task.
|
||||
|
|
|||
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
![]() I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages. I would alias this to _elekLog_ as you seem to be using that prefix when aliasing imports of sub-packages.
![]() Okay. Done Okay. Done
|
|
@ -1,54 +0,0 @@
|
|||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
package elektronLogging
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
import (
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
"os"
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
"strings"
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
"time"
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
log "github.com/sirupsen/logrus"
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
. "github.com/spdfg/elektron/elektronLogging/types"
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
var config LoggerConfig
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
var formatter ElektronFormatter
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
var ElektronLogger *loggerImpl
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
func BuildLogger(prefix string, logConfigFilename string) {
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
// Read configuration from yaml.
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
config.GetConfig(logConfigFilename)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
// Create the log directory.
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
startTime := time.Now()
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
formatter.TimestampFormat = "2006-01-02 15:04:05"
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
formattedStartTime := startTime.Format("20060102150405")
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
logDir := &logDirectory{}
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
logDir.createLogDir(prefix, startTime)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
// Instantiate the logrus instance.
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
prefix = strings.Join([]string{prefix, formattedStartTime}, "_")
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
logger := &log.Logger{
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
Out: os.Stderr,
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
Level: log.DebugLevel,
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
Formatter: &formatter,
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
}
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
// Create a chain of loggers.
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
b := &baseLogData{data: log.Fields{}}
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
head := &loggerImpl{baseLogData: b}
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
cLog := NewConsoleLogger(b, CONSOLE, prefix, logger, logDir)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
pLog := NewPCPLogger(b, PCP, prefix, logger, logDir)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
schedTraceLog := NewSchedTraceLogger(b, SCHED_TRACE, prefix, logger, logDir)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
spsLog := NewSchedPolicySwitchLogger(b, SPS, prefix, logger, logDir)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
schedWindowLog := NewSchedWindowLogger(b, SCHED_WINDOW, prefix, logger, logDir)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
tskDistLog := NewClsfnTaskDistrOverheadLogger(b, CLSFN_TASKDISTR_OVERHEAD, prefix, logger, logDir)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
head.setNext(cLog)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
cLog.setNext(pLog)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
pLog.setNext(schedTraceLog)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
schedTraceLog.setNext(spsLog)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
spsLog.setNext(schedWindowLog)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
schedWindowLog.setNext(tskDistLog)
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
ElektronLogger = head
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
||||
}
|
||||
![]() Logger and Log are synonyms and therefore should not be used interchangeably. Logger and Log are synonyms and therefore should not be used interchangeably.
![]() Comments should start with capital letters and should end with a full stop. Comments should start with capital letters and should end with a full stop.
![]() The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the The second argument to GetLogDir() is a prefix. How is "_" a prefix? This is probably why the log directory name is not ending up prefixed with the one specified with the `-logPrefix` flag.
![]() What is the rationale behind having a dummy node as the head of the chain? What is the rationale behind having a dummy node as the head of the chain?
![]() Done Done
![]() Nothing specific. I had kept Nothing specific. I had kept `ElektronLog` as `LoggerImpl` type. But I have changed to `ConsoleLogger` rather. Works fine now
![]() Done Done
![]() Changed Changed `ElektronLog` to `ElektronLogger`
|
|
@ -1,56 +0,0 @@
|
|||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
package elektronLogging
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
import (
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
log "github.com/sirupsen/logrus"
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
"os"
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
)
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
type logInterface interface {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
setNext(logType logInterface)
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
Log(logType int, level log.Level, message string)
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
Logf(logType int, level log.Level, msgFmtString string, args ...interface{})
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
createLogFile(prefix string)
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
type baseLogData struct {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
data log.Fields
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
type loggerImpl struct {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
*baseLogData
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
logType int
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
allowOnConsole bool
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
logFile *os.File
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
next logInterface
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
logger *log.Logger
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
logDir *logDirectory
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
func (l *loggerImpl) WithFields(logData log.Fields) *loggerImpl {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.data = logData
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
return l
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
func (l *loggerImpl) WithField(key string, value string) *loggerImpl {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.data[key] = value
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
return l
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
func (l *loggerImpl) setNext(logType logInterface) {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.next = logType
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
func (l loggerImpl) Log(logType int, level log.Level, message string) {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
if l.next != nil {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.next.Log(logType, level, message)
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
func (l loggerImpl) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
if l.next != nil {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.next.Logf(logType, level, msgFmtString, args...)
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
func (l *loggerImpl) resetFields() {
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.data = nil
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
l.data = log.Fields{}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]() If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here. If the code isn't needed it shouldn't be left here. If the commented out code is still needed there should be some justification for it still being here.
![]() Okay. Will remove the unnecessary code Okay. Will remove the unnecessary code
![]() As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all. As fields are optional, it is better to either have them as the last argument or not have them in the argument list at all.
I would in fact also maintain an internal data structure to store Fields that is cleared only after the log operation passes through the entire chain. You can then add a `WithFields(...)` method that wraps around `logrus.WithFields(...)`.
I have created [this sample code](https://play.golang.org/p/RILTxcZtT2w) for reference. The sample code also shows how formatted strings are corresponding args can be passed and we can wrap around `logrus.Logf(...)` for that.
![]() Refactor to Refactor to `LogFile` as it is a pointer to os.File and not string.
![]() Done Done
![]() Done Done
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
@ -8,26 +8,44 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type ClsfnTaskDistrOverheadLogger struct {
|
||||
loggerImpl
|
||||
type clsfnTaskDistrOverheadLogger struct {
|
||||
baseElektronLogger
|
||||
}
|
||||
|
||||
func NewClsfnTaskDistrOverheadLogger(b *baseLogData, logType int, prefix string,
|
||||
logger *log.Logger, logDir *logDirectory) *ClsfnTaskDistrOverheadLogger {
|
||||
cLog := &ClsfnTaskDistrOverheadLogger{}
|
||||
cLog.logType = logType
|
||||
cLog.logDir = logDir
|
||||
cLog.next = nil
|
||||
cLog.baseLogData = b
|
||||
cLog.logger = logger
|
||||
func newClsfnTaskDistrOverheadLogger(
|
||||
config *loggerConfig,
|
||||
b *baseLogData,
|
||||
logType int,
|
||||
prefix string,
|
||||
logger *log.Logger,
|
||||
logDir *logDirectory) *clsfnTaskDistrOverheadLogger {
|
||||
|
||||
cLog := &clsfnTaskDistrOverheadLogger{
|
||||
baseElektronLogger: baseElektronLogger{
|
||||
baseLogData: b,
|
||||
config: struct {
|
||||
Enabled bool
|
||||
FilenameExtension string
|
||||
AllowOnConsole bool
|
||||
}{
|
||||
Enabled: config.TaskDistrConfig.Enabled,
|
||||
FilenameExtension: config.TaskDistrConfig.FilenameExtension,
|
||||
AllowOnConsole: config.TaskDistrConfig.AllowOnConsole,
|
||||
},
|
||||
logType: logType,
|
||||
next: nil,
|
||||
logger: logger,
|
||||
logDir: logDir,
|
||||
},
|
||||
}
|
||||
|
||||
cLog.createLogFile(prefix)
|
||||
return cLog
|
||||
}
|
||||
|
||||
func (cLog ClsfnTaskDistrOverheadLogger) Log(logType int, level log.Level, message string) {
|
||||
func (cLog clsfnTaskDistrOverheadLogger) Log(logType int, level log.Level, message string) {
|
||||
if cLog.logType == logType {
|
||||
if config.TaskDistrConfig.Enabled {
|
||||
if cLog.allowOnConsole {
|
||||
if cLog.isEnabled() {
|
||||
if cLog.config.AllowOnConsole {
|
||||
cLog.logger.SetOutput(os.Stdout)
|
||||
cLog.logger.WithFields(cLog.data).Log(level, message)
|
||||
}
|
||||
|
@ -45,10 +63,10 @@ func (cLog ClsfnTaskDistrOverheadLogger) Log(logType int, level log.Level, messa
|
|||
}
|
||||
}
|
||||
|
||||
func (cLog ClsfnTaskDistrOverheadLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
func (cLog clsfnTaskDistrOverheadLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
if cLog.logType == logType {
|
||||
if config.TaskDistrConfig.Enabled {
|
||||
if cLog.allowOnConsole {
|
||||
if cLog.isEnabled() {
|
||||
if cLog.config.AllowOnConsole {
|
||||
cLog.logger.SetOutput(os.Stdout)
|
||||
cLog.logger.WithFields(cLog.data).Logf(level, msgFmtString, args...)
|
||||
}
|
||||
|
@ -65,17 +83,16 @@ func (cLog ClsfnTaskDistrOverheadLogger) Logf(logType int, level log.Level, msgF
|
|||
}
|
||||
}
|
||||
|
||||
func (cLog *ClsfnTaskDistrOverheadLogger) createLogFile(prefix string) {
|
||||
func (cLog *clsfnTaskDistrOverheadLogger) createLogFile(prefix string) {
|
||||
|
||||
if config.TaskDistrConfig.Enabled {
|
||||
filename := strings.Join([]string{prefix, config.TaskDistrConfig.FilenameExtension}, "")
|
||||
if cLog.isEnabled() {
|
||||
filename := strings.Join([]string{prefix, cLog.config.FilenameExtension}, "")
|
||||
dirName := cLog.logDir.getDirName()
|
||||
if dirName != "" {
|
||||
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {
|
||||
log.Fatal("Unable to create logFile: ", err)
|
||||
} else {
|
||||
cLog.logFile = logFile
|
||||
cLog.allowOnConsole = config.TaskDistrConfig.AllowOnConsole
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -8,24 +8,47 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
type ConsoleLogger struct {
|
||||
loggerImpl
|
||||
type consoleLogger struct {
|
||||
baseElektronLogger
|
||||
MinLogLevel string
|
||||
}
|
||||
|
||||
func NewConsoleLogger(b *baseLogData, logType int, prefix string,
|
||||
logger *log.Logger, logDir *logDirectory) *ConsoleLogger {
|
||||
cLog := &ConsoleLogger{}
|
||||
cLog.logType = logType
|
||||
cLog.logDir = logDir
|
||||
cLog.next = nil
|
||||
cLog.baseLogData = b
|
||||
cLog.logger = logger
|
||||
func newConsoleLogger(
|
||||
config *loggerConfig,
|
||||
b *baseLogData,
|
||||
logType int,
|
||||
prefix string,
|
||||
logger *log.Logger,
|
||||
logDir *logDirectory) *consoleLogger {
|
||||
|
||||
cLog := &consoleLogger{
|
||||
baseElektronLogger: baseElektronLogger{
|
||||
baseLogData: b,
|
||||
config: struct {
|
||||
Enabled bool
|
||||
FilenameExtension string
|
||||
AllowOnConsole bool
|
||||
}{
|
||||
Enabled: config.ConsoleConfig.Enabled,
|
||||
FilenameExtension: config.ConsoleConfig.FilenameExtension,
|
||||
AllowOnConsole: config.ConsoleConfig.AllowOnConsole,
|
||||
},
|
||||
logType: logType,
|
||||
next: nil,
|
||||
logger: logger,
|
||||
logDir: logDir,
|
||||
},
|
||||
|
||||
MinLogLevel: config.ConsoleConfig.MinLogLevel,
|
||||
}
|
||||
|
||||
cLog.createLogFile(prefix)
|
||||
return cLog
|
||||
}
|
||||
func (cLog ConsoleLogger) Log(logType int, level log.Level, message string) {
|
||||
|
||||
func (cLog consoleLogger) Log(logType int, level log.Level, message string) {
|
||||
if logType <= cLog.logType {
|
||||
if config.ConsoleConfig.Enabled {
|
||||
if cLog.isEnabled() {
|
||||
cLog.logger.SetOutput(os.Stdout)
|
||||
cLog.logger.WithFields(cLog.data).Log(level, message)
|
||||
|
||||
|
@ -42,9 +65,9 @@ func (cLog ConsoleLogger) Log(logType int, level log.Level, message string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (cLog ConsoleLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
func (cLog consoleLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
if logType <= cLog.logType {
|
||||
if config.ConsoleConfig.Enabled {
|
||||
if cLog.isEnabled() {
|
||||
cLog.logger.SetOutput(os.Stdout)
|
||||
cLog.logger.WithFields(cLog.data).Logf(level, msgFmtString, args...)
|
||||
|
||||
|
@ -60,10 +83,10 @@ func (cLog ConsoleLogger) Logf(logType int, level log.Level, msgFmtString string
|
|||
}
|
||||
}
|
||||
|
||||
func (cLog *ConsoleLogger) createLogFile(prefix string) {
|
||||
func (cLog *consoleLogger) createLogFile(prefix string) {
|
||||
// Create log file for the type if it is enabled.
|
||||
if config.ConsoleConfig.Enabled {
|
||||
filename := strings.Join([]string{prefix, config.ConsoleConfig.FilenameExtension}, "")
|
||||
if cLog.isEnabled() {
|
||||
filename := strings.Join([]string{prefix, cLog.config.FilenameExtension}, "")
|
||||
dirName := cLog.logDir.getDirName()
|
||||
fmt.Println(dirName)
|
||||
if dirName != "" {
|
||||
|
@ -71,7 +94,6 @@ func (cLog *ConsoleLogger) createLogFile(prefix string) {
|
|||
log.Fatal("Unable to create logFile: ", err)
|
||||
} else {
|
||||
cLog.logFile = logFile
|
||||
cLog.allowOnConsole = config.ConsoleConfig.AllowOnConsole
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -8,11 +8,11 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type ElektronFormatter struct {
|
||||
type elektronFormatter struct {
|
||||
TimestampFormat string
|
||||
}
|
||||
|
||||
func (f ElektronFormatter) Format(entry *log.Entry) ([]byte, error) {
|
||||
func (f elektronFormatter) Format(entry *log.Entry) ([]byte, error) {
|
||||
var b *bytes.Buffer
|
||||
|
||||
if entry.Buffer != nil {
|
140
logging/logger.go
Normal file
|
@ -0,0 +1,140 @@
|
|||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
package logging
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
import (
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
"github.com/pkg/errors"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
"os"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
"strings"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
"time"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
log "github.com/sirupsen/logrus"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
// var config loggerConfig
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
var formatter elektronFormatter
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
var elektronLoggerInstance elektronLogger
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
type elektronLogger interface {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
setNext(next elektronLogger)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
isEnabled() bool
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
Log(logType int, level log.Level, message string)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
Logf(logType int, level log.Level, msgFmtString string, args ...interface{})
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
WithFields(logData log.Fields) elektronLogger
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
WithField(key string, value string) elektronLogger
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
type baseLogData struct {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
data log.Fields
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
type baseElektronLogger struct {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
*baseLogData
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
config struct {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
Enabled bool
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
FilenameExtension string
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
AllowOnConsole bool
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logType int
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logFile *os.File
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
next elektronLogger
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logger *log.Logger
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logDir *logDirectory
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l baseElektronLogger) isEnabled() bool {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return l.config.Enabled
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l *baseElektronLogger) WithFields(logData log.Fields) elektronLogger {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.data = logData
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return l
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l *baseElektronLogger) WithField(key string, value string) elektronLogger {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.data[key] = value
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return l
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l *baseElektronLogger) setNext(next elektronLogger) {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.next = next
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l baseElektronLogger) Log(logType int, level log.Level, message string) {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
if l.next != nil {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.next.Log(logType, level, message)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l baseElektronLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
if l.next != nil {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.next.Logf(logType, level, msgFmtString, args...)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func (l *baseElektronLogger) resetFields() {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.data = nil
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
l.data = log.Fields{}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func BuildLogger(prefix string, logConfigFilename string) error {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
// Create the log directory.
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
startTime := time.Now()
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
formatter.TimestampFormat = "2006-01-02 15:04:05"
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
formattedStartTime := startTime.Format("20060102150405")
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logDir := &logDirectory{}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logDir.createLogDir(prefix, startTime)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
// Instantiate the logrus instance.
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
prefix = strings.Join([]string{prefix, formattedStartTime}, "_")
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
logger := &log.Logger{
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
Out: os.Stderr,
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
Level: log.DebugLevel,
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
Formatter: &formatter,
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
// Create a chain of loggers.
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
b := &baseLogData{data: log.Fields{}}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
head := &baseElektronLogger{baseLogData: b}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
// Read configuration from yaml.
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
if config, err := GetConfig(logConfigFilename); err != nil {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return errors.Wrap(err, "Failed to build logger")
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
} else {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
cLog := newConsoleLogger(config, b, CONSOLE, prefix, logger, logDir)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
pLog := newPCPLogger(config, b, PCP, prefix, logger, logDir)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
schedTraceLog := newSchedTraceLogger(config, b, SCHED_TRACE, prefix, logger, logDir)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
spsLog := newSchedPolicySwitchLogger(config, b, SPS, prefix, logger, logDir)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
schedWindowLog := newSchedWindowLogger(config, b, SCHED_WINDOW, prefix, logger, logDir)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
tskDistLog := newClsfnTaskDistrOverheadLogger(config, b, CLSFN_TASKDISTR_OVERHEAD, prefix, logger, logDir)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
head.setNext(cLog)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
cLog.setNext(pLog)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
pLog.setNext(schedTraceLog)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
schedTraceLog.setNext(spsLog)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
spsLog.setNext(schedWindowLog)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
schedWindowLog.setNext(tskDistLog)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
elektronLoggerInstance = head
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return nil
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func Log(logType int, level log.Level, message string) {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
elektronLoggerInstance.Log(logType, level, message)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
elektronLoggerInstance.Logf(logType, level, msgFmtString, args...)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func WithFields(logData log.Fields) elektronLogger {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return elektronLoggerInstance.WithFields(logData)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
func WithField(key string, value string) elektronLogger {
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
return elektronLoggerInstance.WithField(key, value)
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
||||
}
|
||||
![]()
`isEnabled()` does not have to be part of the interface.
![]() ditto ditto
![]() ditto ditto
![]() Yes. Removed it from there Yes. Removed it from there
![]() Done Done
![]() Done Done
|
|
@ -1,12 +1,13 @@
|
|||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
package elektronLogging
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
package logging
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type LoggerConfig struct {
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
type loggerConfig struct {
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
SchedTraceConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
FilenameExtension string `yaml:"filenameExtension"`
|
||||
|
@ -47,16 +48,18 @@ type LoggerConfig struct {
|
|||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
Format []string `yaml:"format"`
|
||||
}
|
||||
|
||||
func (c *LoggerConfig) GetConfig(logConfigFilename string) *LoggerConfig {
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
func GetConfig(logConfigFilename string) (*loggerConfig, error) {
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
|
||||
yamlFile, err := ioutil.ReadFile(logConfigFilename)
|
||||
if err != nil {
|
||||
log.Printf("Error in reading yaml file #%v ", err)
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
return nil, errors.Wrap(err, "failed to read log config file")
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
}
|
||||
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
c := &loggerConfig{}
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
err = yaml.Unmarshal(yamlFile, c)
|
||||
if err != nil {
|
||||
log.Fatalf("Error in unmarshalling yaml: %v", err)
|
||||
}
|
||||
|
||||
return c
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
return c, nil
|
||||
![]() does this need to be exported outside the package? does this need to be exported outside the package?
![]() No, not needed. Changed it to No, not needed. Changed it to `getConfig` .
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
@ -8,26 +8,45 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type PCPLogger struct {
|
||||
loggerImpl
|
||||
type pcpLogger struct {
|
||||
baseElektronLogger
|
||||
}
|
||||
|
||||
func NewPCPLogger(b *baseLogData, logType int, prefix string,
|
||||
logger *log.Logger, logDir *logDirectory) *PCPLogger {
|
||||
pLog := &PCPLogger{}
|
||||
pLog.logType = logType
|
||||
pLog.logDir = logDir
|
||||
pLog.next = nil
|
||||
pLog.baseLogData = b
|
||||
pLog.logger = logger
|
||||
func newPCPLogger(
|
||||
config *loggerConfig,
|
||||
b *baseLogData,
|
||||
logType int,
|
||||
prefix string,
|
||||
logger *log.Logger,
|
||||
logDir *logDirectory) *pcpLogger {
|
||||
|
||||
pLog := &pcpLogger{
|
||||
baseElektronLogger: baseElektronLogger{
|
||||
baseLogData: b,
|
||||
config: struct {
|
||||
Enabled bool
|
||||
FilenameExtension string
|
||||
AllowOnConsole bool
|
||||
}{
|
||||
Enabled: config.PCPConfig.Enabled,
|
||||
FilenameExtension: config.PCPConfig.FilenameExtension,
|
||||
AllowOnConsole: config.PCPConfig.AllowOnConsole,
|
||||
},
|
||||
logType: logType,
|
||||
next: nil,
|
||||
logger: logger,
|
||||
logDir: logDir,
|
||||
},
|
||||
}
|
||||
|
||||
pLog.createLogFile(prefix)
|
||||
return pLog
|
||||
}
|
||||
|
||||
func (pLog PCPLogger) Log(logType int, level log.Level, message string) {
|
||||
func (pLog pcpLogger) Log(logType int, level log.Level, message string) {
|
||||
if pLog.logType == logType {
|
||||
if config.PCPConfig.Enabled {
|
||||
if pLog.allowOnConsole {
|
||||
if pLog.isEnabled() {
|
||||
if pLog.config.AllowOnConsole {
|
||||
pLog.logger.SetOutput(os.Stdout)
|
||||
pLog.logger.WithFields(pLog.data).Log(level, message)
|
||||
}
|
||||
|
@ -44,10 +63,10 @@ func (pLog PCPLogger) Log(logType int, level log.Level, message string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (pLog PCPLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
func (pLog pcpLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
if pLog.logType == logType {
|
||||
if config.PCPConfig.Enabled {
|
||||
if pLog.allowOnConsole {
|
||||
if pLog.isEnabled() {
|
||||
if pLog.config.AllowOnConsole {
|
||||
pLog.logger.SetOutput(os.Stdout)
|
||||
pLog.logger.WithFields(pLog.data).Logf(level, msgFmtString, args...)
|
||||
}
|
||||
|
@ -65,16 +84,15 @@ func (pLog PCPLogger) Logf(logType int, level log.Level, msgFmtString string, ar
|
|||
}
|
||||
}
|
||||
|
||||
func (pLog *PCPLogger) createLogFile(prefix string) {
|
||||
if config.PCPConfig.Enabled {
|
||||
filename := strings.Join([]string{prefix, config.PCPConfig.FilenameExtension}, "")
|
||||
func (pLog *pcpLogger) createLogFile(prefix string) {
|
||||
if pLog.isEnabled() {
|
||||
filename := strings.Join([]string{prefix, pLog.config.FilenameExtension}, "")
|
||||
dirName := pLog.logDir.getDirName()
|
||||
if dirName != "" {
|
||||
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {
|
||||
log.Fatal("Unable to create logFile: ", err)
|
||||
} else {
|
||||
pLog.logFile = logFile
|
||||
pLog.allowOnConsole = config.PCPConfig.AllowOnConsole
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
@ -8,26 +8,45 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type SchedPolicySwitchLogger struct {
|
||||
loggerImpl
|
||||
type schedPolicySwitchLogger struct {
|
||||
baseElektronLogger
|
||||
}
|
||||
|
||||
func NewSchedPolicySwitchLogger(b *baseLogData, logType int, prefix string,
|
||||
logger *log.Logger, logDir *logDirectory) *SchedPolicySwitchLogger {
|
||||
sLog := &SchedPolicySwitchLogger{}
|
||||
sLog.logType = logType
|
||||
sLog.logDir = logDir
|
||||
sLog.next = nil
|
||||
sLog.baseLogData = b
|
||||
sLog.logger = logger
|
||||
func newSchedPolicySwitchLogger(
|
||||
config *loggerConfig,
|
||||
b *baseLogData,
|
||||
logType int,
|
||||
prefix string,
|
||||
logger *log.Logger,
|
||||
logDir *logDirectory) *schedPolicySwitchLogger {
|
||||
|
||||
sLog := &schedPolicySwitchLogger{
|
||||
baseElektronLogger: baseElektronLogger{
|
||||
baseLogData: b,
|
||||
config: struct {
|
||||
Enabled bool
|
||||
FilenameExtension string
|
||||
AllowOnConsole bool
|
||||
}{
|
||||
Enabled: config.SPSConfig.Enabled,
|
||||
FilenameExtension: config.SPSConfig.FilenameExtension,
|
||||
AllowOnConsole: config.SPSConfig.AllowOnConsole,
|
||||
},
|
||||
logType: logType,
|
||||
next: nil,
|
||||
logger: logger,
|
||||
logDir: logDir,
|
||||
},
|
||||
}
|
||||
|
||||
sLog.createLogFile(prefix)
|
||||
return sLog
|
||||
}
|
||||
|
||||
func (sLog SchedPolicySwitchLogger) Log(logType int, level log.Level, message string) {
|
||||
func (sLog schedPolicySwitchLogger) Log(logType int, level log.Level, message string) {
|
||||
if sLog.logType == logType {
|
||||
if config.SPSConfig.Enabled {
|
||||
if sLog.allowOnConsole {
|
||||
if sLog.isEnabled() {
|
||||
if sLog.config.AllowOnConsole {
|
||||
sLog.logger.SetOutput(os.Stdout)
|
||||
sLog.logger.WithFields(sLog.data).Log(level, message)
|
||||
}
|
||||
|
@ -44,10 +63,10 @@ func (sLog SchedPolicySwitchLogger) Log(logType int, level log.Level, message st
|
|||
}
|
||||
}
|
||||
|
||||
func (sLog SchedPolicySwitchLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
func (sLog schedPolicySwitchLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
if sLog.logType == logType {
|
||||
if config.SPSConfig.Enabled {
|
||||
if sLog.allowOnConsole {
|
||||
if sLog.isEnabled() {
|
||||
if sLog.config.AllowOnConsole {
|
||||
sLog.logger.SetOutput(os.Stdout)
|
||||
sLog.logger.WithFields(sLog.data).Logf(level, msgFmtString, args...)
|
||||
}
|
||||
|
@ -65,16 +84,15 @@ func (sLog SchedPolicySwitchLogger) Logf(logType int, level log.Level, msgFmtStr
|
|||
}
|
||||
}
|
||||
|
||||
func (sLog *SchedPolicySwitchLogger) createLogFile(prefix string) {
|
||||
if config.SPSConfig.Enabled {
|
||||
filename := strings.Join([]string{prefix, config.SPSConfig.FilenameExtension}, "")
|
||||
func (sLog *schedPolicySwitchLogger) createLogFile(prefix string) {
|
||||
if sLog.isEnabled() {
|
||||
filename := strings.Join([]string{prefix, sLog.config.FilenameExtension}, "")
|
||||
dirName := sLog.logDir.getDirName()
|
||||
if dirName != "" {
|
||||
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {
|
||||
log.Fatal("Unable to create logFile: ", err)
|
||||
} else {
|
||||
sLog.logFile = logFile
|
||||
sLog.allowOnConsole = config.SPSConfig.AllowOnConsole
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
@ -8,26 +8,45 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type SchedTraceLogger struct {
|
||||
loggerImpl
|
||||
type schedTraceLogger struct {
|
||||
baseElektronLogger
|
||||
}
|
||||
|
||||
func NewSchedTraceLogger(b *baseLogData, logType int, prefix string,
|
||||
logger *log.Logger, logDir *logDirectory) *SchedTraceLogger {
|
||||
sLog := &SchedTraceLogger{}
|
||||
sLog.logType = logType
|
||||
sLog.logDir = logDir
|
||||
sLog.next = nil
|
||||
sLog.baseLogData = b
|
||||
sLog.logger = logger
|
||||
func newSchedTraceLogger(
|
||||
config *loggerConfig,
|
||||
b *baseLogData,
|
||||
logType int,
|
||||
prefix string,
|
||||
logger *log.Logger,
|
||||
logDir *logDirectory) *schedTraceLogger {
|
||||
|
||||
sLog := &schedTraceLogger{
|
||||
baseElektronLogger: baseElektronLogger{
|
||||
baseLogData: b,
|
||||
config: struct {
|
||||
Enabled bool
|
||||
FilenameExtension string
|
||||
AllowOnConsole bool
|
||||
}{
|
||||
Enabled: config.SchedTraceConfig.Enabled,
|
||||
FilenameExtension: config.SchedTraceConfig.FilenameExtension,
|
||||
AllowOnConsole: config.SchedTraceConfig.AllowOnConsole,
|
||||
},
|
||||
logType: logType,
|
||||
next: nil,
|
||||
logger: logger,
|
||||
logDir: logDir,
|
||||
},
|
||||
}
|
||||
|
||||
sLog.createLogFile(prefix)
|
||||
return sLog
|
||||
}
|
||||
|
||||
func (sLog SchedTraceLogger) Log(logType int, level log.Level, message string) {
|
||||
func (sLog schedTraceLogger) Log(logType int, level log.Level, message string) {
|
||||
if sLog.logType == logType {
|
||||
if config.SchedTraceConfig.Enabled {
|
||||
if sLog.allowOnConsole {
|
||||
if sLog.isEnabled() {
|
||||
if sLog.config.AllowOnConsole {
|
||||
sLog.logger.SetOutput(os.Stdout)
|
||||
sLog.logger.WithFields(sLog.data).Log(level, message)
|
||||
}
|
||||
|
@ -44,10 +63,10 @@ func (sLog SchedTraceLogger) Log(logType int, level log.Level, message string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (sLog SchedTraceLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
func (sLog schedTraceLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
if sLog.logType == logType {
|
||||
if config.SchedTraceConfig.Enabled {
|
||||
if sLog.allowOnConsole {
|
||||
if sLog.isEnabled() {
|
||||
if sLog.config.AllowOnConsole {
|
||||
sLog.logger.SetOutput(os.Stdout)
|
||||
sLog.logger.WithFields(sLog.data).Logf(level, msgFmtString, args...)
|
||||
}
|
||||
|
@ -65,16 +84,15 @@ func (sLog SchedTraceLogger) Logf(logType int, level log.Level, msgFmtString str
|
|||
}
|
||||
}
|
||||
|
||||
func (sLog *SchedTraceLogger) createLogFile(prefix string) {
|
||||
if config.SchedTraceConfig.Enabled {
|
||||
filename := strings.Join([]string{prefix, config.SchedTraceConfig.FilenameExtension}, "")
|
||||
func (sLog *schedTraceLogger) createLogFile(prefix string) {
|
||||
if sLog.isEnabled() {
|
||||
filename := strings.Join([]string{prefix, sLog.config.FilenameExtension}, "")
|
||||
dirName := sLog.logDir.getDirName()
|
||||
if dirName != "" {
|
||||
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {
|
||||
log.Fatal("Unable to create logFile: ", err)
|
||||
} else {
|
||||
sLog.logFile = logFile
|
||||
sLog.allowOnConsole = config.SchedTraceConfig.AllowOnConsole
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package logging
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
@ -8,26 +8,45 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type SchedWindowLogger struct {
|
||||
loggerImpl
|
||||
type schedWindowLogger struct {
|
||||
baseElektronLogger
|
||||
}
|
||||
|
||||
func NewSchedWindowLogger(b *baseLogData, logType int, prefix string,
|
||||
logger *log.Logger, logDir *logDirectory) *SchedWindowLogger {
|
||||
sLog := &SchedWindowLogger{}
|
||||
sLog.logType = logType
|
||||
sLog.logDir = logDir
|
||||
sLog.next = nil
|
||||
sLog.baseLogData = b
|
||||
sLog.logger = logger
|
||||
func newSchedWindowLogger(
|
||||
config *loggerConfig,
|
||||
b *baseLogData,
|
||||
logType int,
|
||||
prefix string,
|
||||
logger *log.Logger,
|
||||
logDir *logDirectory) *schedWindowLogger {
|
||||
|
||||
sLog := &schedWindowLogger{
|
||||
baseElektronLogger: baseElektronLogger{
|
||||
baseLogData: b,
|
||||
config: struct {
|
||||
Enabled bool
|
||||
FilenameExtension string
|
||||
AllowOnConsole bool
|
||||
}{
|
||||
Enabled: config.SchedWindowConfig.Enabled,
|
||||
FilenameExtension: config.SchedWindowConfig.FilenameExtension,
|
||||
AllowOnConsole: config.SchedWindowConfig.AllowOnConsole,
|
||||
},
|
||||
logType: logType,
|
||||
next: nil,
|
||||
logger: logger,
|
||||
logDir: logDir,
|
||||
},
|
||||
}
|
||||
|
||||
sLog.createLogFile(prefix)
|
||||
return sLog
|
||||
}
|
||||
|
||||
func (sLog SchedWindowLogger) Log(logType int, level log.Level, message string) {
|
||||
func (sLog schedWindowLogger) Log(logType int, level log.Level, message string) {
|
||||
if sLog.logType == logType {
|
||||
if config.SchedWindowConfig.Enabled {
|
||||
if sLog.allowOnConsole {
|
||||
if sLog.isEnabled() {
|
||||
if sLog.config.AllowOnConsole {
|
||||
sLog.logger.SetOutput(os.Stdout)
|
||||
sLog.logger.WithFields(sLog.data).Log(level, message)
|
||||
}
|
||||
|
@ -45,10 +64,10 @@ func (sLog SchedWindowLogger) Log(logType int, level log.Level, message string)
|
|||
}
|
||||
}
|
||||
|
||||
func (sLog SchedWindowLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
func (sLog schedWindowLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
|
||||
if sLog.logType == logType {
|
||||
if config.SchedWindowConfig.Enabled {
|
||||
if sLog.allowOnConsole {
|
||||
if sLog.isEnabled() {
|
||||
if sLog.config.AllowOnConsole {
|
||||
sLog.logger.SetOutput(os.Stdout)
|
||||
sLog.logger.WithFields(sLog.data).Logf(level, msgFmtString, args...)
|
||||
}
|
||||
|
@ -65,16 +84,15 @@ func (sLog SchedWindowLogger) Logf(logType int, level log.Level, msgFmtString st
|
|||
}
|
||||
}
|
||||
|
||||
func (sLog *SchedWindowLogger) createLogFile(prefix string) {
|
||||
if config.SchedWindowConfig.Enabled {
|
||||
filename := strings.Join([]string{prefix, config.SchedWindowConfig.FilenameExtension}, "")
|
||||
func (sLog *schedWindowLogger) createLogFile(prefix string) {
|
||||
if sLog.isEnabled() {
|
||||
filename := strings.Join([]string{prefix, sLog.config.FilenameExtension}, "")
|
||||
dirName := sLog.logDir.getDirName()
|
||||
if dirName != "" {
|
||||
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {
|
||||
log.Fatal("Unable to create logFile: ", err)
|
||||
} else {
|
||||
sLog.logFile = logFile
|
||||
sLog.allowOnConsole = config.SchedWindowConfig.AllowOnConsole
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package elektronLogging
|
||||
package types
|
||||
|
||||
const (
|
||||
CONSOLE = iota
|
12
pcp/pcp.go
|
@ -25,8 +25,8 @@ import (
|
|||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
)
|
||||
|
||||
func Start(quit chan struct{}, logging *bool, pcpConfigFile string) {
|
||||
|
@ -47,7 +47,7 @@ func Start(quit chan struct{}, logging *bool, pcpConfigFile string) {
|
|||
scanner.Scan()
|
||||
|
||||
// Write to logfile
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.PCP, log.InfoLevel, scanner.Text())
|
||||
elekLog.Log(PCP, log.InfoLevel, scanner.Text())
|
||||
|
||||
// Throw away first set of results
|
||||
scanner.Scan()
|
||||
|
@ -58,14 +58,14 @@ func Start(quit chan struct{}, logging *bool, pcpConfigFile string) {
|
|||
text := scanner.Text()
|
||||
|
||||
if *logging {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.PCP, log.InfoLevel, text)
|
||||
elekLog.Log(PCP, log.InfoLevel, text)
|
||||
}
|
||||
|
||||
seconds++
|
||||
}
|
||||
}(logging)
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "PCP logging started")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "PCP logging started")
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -75,7 +75,7 @@ func Start(quit chan struct{}, logging *bool, pcpConfigFile string) {
|
|||
|
||||
select {
|
||||
case <-quit:
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Stopping PCP logging in 5 seconds")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Stopping PCP logging in 5 seconds")
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
// http://stackoverflow.com/questions/22470193/why-wont-go-kill-a-child-process-correctly
|
||||
|
|
|
@ -30,8 +30,8 @@ import (
|
|||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
"github.com/spdfg/elektron/pcp"
|
||||
"github.com/spdfg/elektron/rapl"
|
||||
)
|
||||
|
@ -43,7 +43,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
if hiThreshold < loThreshold {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "High threshold is lower than low threshold!")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "High threshold is lower than low threshold!")
|
||||
}
|
||||
|
||||
pipe, err := cmd.StdoutPipe()
|
||||
|
@ -59,7 +59,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
scanner.Scan()
|
||||
|
||||
// Write to logfile
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.PCP, log.InfoLevel, scanner.Text())
|
||||
elekLog.Log(PCP, log.InfoLevel, scanner.Text())
|
||||
|
||||
headers := strings.Split(scanner.Text(), ",")
|
||||
|
||||
|
@ -95,12 +95,12 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
|
||||
if *logging {
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Logging PCP...")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Logging PCP...")
|
||||
|
||||
text := scanner.Text()
|
||||
split := strings.Split(text, ",")
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.PCP, log.InfoLevel, text)
|
||||
elekLog.Log(PCP, log.InfoLevel, text)
|
||||
|
||||
totalPower := 0.0
|
||||
for _, powerIndex := range powerIndexes {
|
||||
|
@ -111,8 +111,10 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
powerHistories[host].Value = power
|
||||
powerHistories[host] = powerHistories[host].Next()
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Host": fmt.Sprintf("%s", indexToHost[powerIndex]),
|
||||
"Power": fmt.Sprintf("%f", (power * pcp.RAPLUnits))}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"Host": indexToHost[powerIndex],
|
||||
"Power": fmt.Sprintf("%f", power*pcp.RAPLUnits),
|
||||
}).Log(CONSOLE, log.InfoLevel, "")
|
||||
|
||||
totalPower += power
|
||||
}
|
||||
|
@ -123,12 +125,13 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
|
||||
clusterMean := pcp.AverageClusterPowerHistory(clusterPowerHist)
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Total power": fmt.Sprintf("%f %d", clusterPower, clusterPowerHist.Len()),
|
||||
"Sec Avg": fmt.Sprintf("%f", clusterMean)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"Total power": fmt.Sprintf("%f %d Sec", clusterPower, clusterPowerHist.Len()),
|
||||
"Avg": fmt.Sprintf("%f", clusterMean),
|
||||
}).Log(CONSOLE, log.InfoLevel, "")
|
||||
|
||||
if clusterMean > hiThreshold {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "Need to cap a node")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Need to cap a node")
|
||||
// Create statics for all victims and choose one to cap
|
||||
victims := make([]pcp.Victim, 0, 8)
|
||||
|
||||
|
@ -149,12 +152,10 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
if !cappedHosts[victim.Host] {
|
||||
cappedHosts[victim.Host] = true
|
||||
orderCapped = append(orderCapped, victim.Host)
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Capping Victim": fmt.Sprintf("%s", victim.Host),
|
||||
"Avg. Wattage": fmt.Sprintf("%f", victim.Watts*pcp.RAPLUnits)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.WithField("Avg. Wattage",
|
||||
fmt.Sprintf("%f", victim.Watts*pcp.RAPLUnits)).Logf(CONSOLE, log.InfoLevel, "Capping Victim %s", victim.Host)
|
||||
if err := rapl.Cap(victim.Host, "rapl", 50); err != nil {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE,
|
||||
log.ErrorLevel,
|
||||
"Error capping host")
|
||||
elekLog.Log(CONSOLE, log.ErrorLevel, "Error capping host")
|
||||
}
|
||||
break // Only cap one machine at at time.
|
||||
}
|
||||
|
@ -167,10 +168,9 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
orderCapped = orderCapped[:len(orderCapped)-1]
|
||||
cappedHosts[host] = false
|
||||
// User RAPL package to send uncap.
|
||||
log.Printf("Uncapping host %s", host)
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Uncapped host": host}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Uncapping host %s", host)
|
||||
if err := rapl.Cap(host, "rapl", 100); err != nil {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.ErrorLevel, "Error capping host")
|
||||
elekLog.Log(CONSOLE, log.ErrorLevel, "Error capping host")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
}
|
||||
}(logging, hiThreshold, loThreshold)
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "PCP logging started")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "PCP logging started")
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -190,7 +190,7 @@ func StartPCPLogAndExtremaDynamicCap(quit chan struct{}, logging *bool, hiThresh
|
|||
|
||||
select {
|
||||
case <-quit:
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Stopping PCP logging in 5 seconds")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Stopping PCP logging in 5 seconds")
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
// http://stackoverflow.com/questions/22470193/why-wont-go-kill-a-child-process-correctly
|
||||
|
|
|
@ -32,8 +32,8 @@ import (
|
|||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/constants"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
"github.com/spdfg/elektron/pcp"
|
||||
"github.com/spdfg/elektron/rapl"
|
||||
"github.com/spdfg/elektron/utilities"
|
||||
|
@ -56,7 +56,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||
|
||||
if hiThreshold < loThreshold {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "High threshold is lower than low threshold!")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "High threshold is lower than low threshold!")
|
||||
}
|
||||
|
||||
pipe, err := cmd.StdoutPipe()
|
||||
|
@ -72,7 +72,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
scanner.Scan()
|
||||
|
||||
// Write to logfile
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.PCP, log.InfoLevel, scanner.Text())
|
||||
elekLog.Log(PCP, log.InfoLevel, scanner.Text())
|
||||
|
||||
headers := strings.Split(scanner.Text(), ",")
|
||||
|
||||
|
@ -111,11 +111,11 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
|
||||
for scanner.Scan() {
|
||||
if *logging {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Logging PCP...")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Logging PCP...")
|
||||
split := strings.Split(scanner.Text(), ",")
|
||||
|
||||
text := scanner.Text()
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.PCP, log.InfoLevel, text)
|
||||
elekLog.Log(PCP, log.InfoLevel, text)
|
||||
|
||||
totalPower := 0.0
|
||||
for _, powerIndex := range powerIndexes {
|
||||
|
@ -126,8 +126,10 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
powerHistories[host].Value = power
|
||||
powerHistories[host] = powerHistories[host].Next()
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Host": fmt.Sprintf("%s", indexToHost[powerIndex]),
|
||||
"Power": fmt.Sprintf("%f", (power * pcp.RAPLUnits))}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"Host": indexToHost[powerIndex],
|
||||
"Power": fmt.Sprintf("%f", power*pcp.RAPLUnits),
|
||||
}).Log(CONSOLE, log.InfoLevel, "")
|
||||
totalPower += power
|
||||
}
|
||||
clusterPower := totalPower * pcp.RAPLUnits
|
||||
|
@ -137,15 +139,16 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
|
||||
clusterMean := pcp.AverageClusterPowerHistory(clusterPowerHist)
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Total power": fmt.Sprintf("%f %d", clusterPower, clusterPowerHist.Len()),
|
||||
"Sec Avg": fmt.Sprintf("%f", clusterMean)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"Total power": fmt.Sprintf("%f %d Sec", clusterPower, clusterPowerHist.Len()),
|
||||
"Avg": fmt.Sprintf("%f", clusterMean),
|
||||
}).Log(CONSOLE, log.InfoLevel, "")
|
||||
|
||||
if clusterMean >= hiThreshold {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Need to cap a node")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Need to cap a node")
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Cap values of capped victims %v", cappedVictims)
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Cap values of victims to uncap %v", orderCappedVictims)
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Cap values of capped victims": fmt.Sprintf("%v", cappedVictims)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Cap values of victims to uncap": fmt.Sprintf("%v", orderCappedVictims)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
// Create statics for all victims and choose one to cap
|
||||
victims := make([]pcp.Victim, 0, 8)
|
||||
|
||||
|
@ -173,10 +176,10 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
// Need to cap this victim.
|
||||
if err := rapl.Cap(victims[i].Host, "rapl", 50.0); err != nil {
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Error capping host": fmt.Sprintf("%s", victims[i].Host)}).Log(elekLogTypes.CONSOLE, log.ErrorLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.ErrorLevel, "Error capping host %s", victims[i].Host)
|
||||
} else {
|
||||
|
||||
elekLog.ElektronLogger.Logf(elekLogTypes.CONSOLE, log.InfoLevel, "Capped host[%s] at %f", victims[i].Host, 50.0)
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Capped host[%s] at %f", victims[i].Host, 50.0)
|
||||
// Keeping track of this victim and it's cap value
|
||||
cappedVictims[victims[i].Host] = 50.0
|
||||
newVictimFound = true
|
||||
|
@ -200,11 +203,10 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
newCapValue := getNextCapValue(capValue, 2)
|
||||
if err := rapl.Cap(alreadyCappedHosts[i], "rapl", newCapValue); err != nil {
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Error capping host": fmt.Sprintf("%s", alreadyCappedHosts[i])}).Log(elekLogTypes.CONSOLE, log.ErrorLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.ErrorLevel, "Error capping host %s", alreadyCappedHosts[i])
|
||||
} else {
|
||||
// Successful cap
|
||||
elekLog.ElektronLogger.Logf(elekLogTypes.CONSOLE, log.InfoLevel,
|
||||
"Capped host[%s] at %f", alreadyCappedHosts[i], newCapValue)
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Capped host[%s] at %f", alreadyCappedHosts[i], newCapValue)
|
||||
// Checking whether this victim can be capped further
|
||||
if newCapValue <= constants.LowerCapLimit {
|
||||
// Deleting victim from cappedVictims.
|
||||
|
@ -227,15 +229,15 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
}
|
||||
}
|
||||
if !canCapAlreadyCappedVictim {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "No Victim left to cap")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "No Victim left to cap")
|
||||
}
|
||||
}
|
||||
|
||||
} else if clusterMean < loThreshold {
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Need to uncap a node")
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Cap values of capped victims": fmt.Sprintf("%v", cappedVictims)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Cap values of victims to uncap": fmt.Sprintf("%v", orderCappedVictims)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Need to uncap a node")
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Cap values of capped victims - %v", cappedVictims)
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Cap values of victims to uncap - %v", orderCappedVictims)
|
||||
if len(orderCapped) > 0 {
|
||||
// We pick the host that is capped the most to uncap.
|
||||
orderCappedToSort := utilities.GetPairList(orderCappedVictims)
|
||||
|
@ -246,10 +248,10 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
newUncapValue := orderCappedVictims[hostToUncap] * 2.0
|
||||
if err := rapl.Cap(hostToUncap, "rapl", newUncapValue); err != nil {
|
||||
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Error uncapping host": fmt.Sprintf("%s", hostToUncap)}).Log(elekLogTypes.CONSOLE, log.ErrorLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.ErrorLevel, "Error uncapping host %s", hostToUncap)
|
||||
} else {
|
||||
// Successful uncap
|
||||
elekLog.ElektronLogger.Logf(elekLogTypes.CONSOLE, log.InfoLevel, "Uncapped host[%s] to %f", hostToUncap, newUncapValue)
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Uncapped host[%s] to %f", hostToUncap, newUncapValue)
|
||||
// Can we uncap this host further. If not, then we remove its entry from orderCapped
|
||||
if newUncapValue >= 100.0 { // can compare using ==
|
||||
// Deleting entry from orderCapped
|
||||
|
@ -270,7 +272,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
}
|
||||
}
|
||||
} else {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "No host staged for Uncapped")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "No host staged for Uncapped")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +281,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
|
||||
}(logging, hiThreshold, loThreshold)
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "PCP logging started")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "PCP logging started")
|
||||
if err := cmd.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -288,7 +290,7 @@ func StartPCPLogAndProgressiveExtremaCap(quit chan struct{}, logging *bool, hiTh
|
|||
|
||||
select {
|
||||
case <-quit:
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Stopping PCP logging in 5 seconds")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Stopping PCP logging in 5 seconds")
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
// http://stackoverflow.com/questions/22470193/why-wont-go-kill-a-child-process-correctly
|
||||
|
|
19
scheduler.go
|
@ -31,8 +31,8 @@ import (
|
|||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/def"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
"github.com/spdfg/elektron/pcp"
|
||||
"github.com/spdfg/elektron/powerCap"
|
||||
"github.com/spdfg/elektron/schedulers"
|
||||
|
@ -226,8 +226,11 @@ func main() {
|
|||
if strings.Contains(*pcplogPrefix, "/") {
|
||||
log.Fatal("log file prefix should not contain '/'.")
|
||||
}
|
||||
// Build Logger for elektron.
|
||||
elekLog.BuildLogger(*pcplogPrefix, *logConfigFilename)
|
||||
|
||||
// Build Logger.
|
||||
if err := elekLog.BuildLogger(*pcplogPrefix, *logConfigFilename); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Starting PCP logging.
|
||||
if noPowercap {
|
||||
|
@ -282,8 +285,10 @@ func main() {
|
|||
|
||||
// Starting the scheduler driver.
|
||||
if status, err := driver.Run(); err != nil {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"status": status.String(), "error": err.Error()}).Log(elekLogTypes.CONSOLE,
|
||||
log.ErrorLevel, "Framework stopped ")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"status": status.String(),
|
||||
"error": err.Error(),
|
||||
}).Log(CONSOLE, log.ErrorLevel, "Framework stopped ")
|
||||
}
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Exiting...")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Exiting...")
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import (
|
|||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/def"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
"github.com/spdfg/elektron/utilities"
|
||||
"github.com/spdfg/elektron/utilities/schedUtils"
|
||||
)
|
||||
|
@ -250,31 +250,34 @@ func (s *BaseScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos
|
|||
|
||||
func (s *BaseScheduler) LogTaskStarting(ts *def.Task, offer *mesos.Offer) {
|
||||
if ts == nil {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"host": fmt.Sprintf("%s", offer.GetHostname())}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "TASKS STARTING...")
|
||||
elekLog.WithField("host", offer.GetHostname()).Log(CONSOLE, log.InfoLevel, "TASKS STARTING...")
|
||||
} else {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"task": fmt.Sprintf("%s", ts.Name),
|
||||
"Instance": fmt.Sprintf("%d", *ts.Instances), "host": fmt.Sprintf("%s", offer.GetHostname())}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "TASK STARTING... ")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"task": ts.Name,
|
||||
"Instance": fmt.Sprintf("%d", *ts.Instances),
|
||||
"host": offer.GetHostname(),
|
||||
}).Log(CONSOLE, log.InfoLevel, "TASK STARTING... ")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogTaskWattsConsideration(ts def.Task, host string, wattsToConsider float64) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"task": ts.Name, "host": host, "Watts": fmt.Sprintf("%f", wattsToConsider)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "Watts considered for ")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"task": ts.Name,
|
||||
"host": host,
|
||||
"Watts": fmt.Sprintf("%f", wattsToConsider),
|
||||
}).Log(CONSOLE, log.InfoLevel, "Watts considered for ")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogOffersReceived(offers []*mesos.Offer) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Resource offers received": fmt.Sprintf("%d", len(offers))}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "")
|
||||
elekLog.WithField("numOffers", fmt.Sprintf("%d", len(offers))).Log(CONSOLE, log.InfoLevel, "Resource offers received")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogNoPendingTasksDeclineOffers(offer *mesos.Offer) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"DECLINING OFFER for host": fmt.Sprintf("%s", offer.GetHostname())}).Log(elekLogTypes.CONSOLE,
|
||||
log.WarnLevel, "No tasks left to schedule ")
|
||||
elekLog.Logf(CONSOLE, log.WarnLevel, "DECLINING OFFER for host %s. No tasks left to schedule", offer.GetHostname())
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogNumberOfRunningTasks() {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Number of tasks still Running": fmt.Sprintf("%d", s.tasksRunning)}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Number of tasks still running %d", s.tasksRunning)
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogCoLocatedTasks(slaveID string) {
|
||||
|
@ -284,67 +287,67 @@ func (s *BaseScheduler) LogCoLocatedTasks(slaveID string) {
|
|||
buffer.WriteString(fmt.Sprintln(taskName))
|
||||
}
|
||||
s.TasksRunningMutex.Unlock()
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Colocated with": fmt.Sprintf("%s", buffer.String())}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "")
|
||||
elekLog.WithField("Tasks", buffer.String()).Log(CONSOLE, log.InfoLevel, "Colocated with")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogSchedTrace(taskToSchedule *mesos.TaskInfo, offer *mesos.Offer) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{offer.GetHostname(): fmt.Sprintf("%s", taskToSchedule.GetTaskId().GetValue())}).Log(elekLogTypes.SCHED_TRACE, log.InfoLevel, "")
|
||||
elekLog.WithField(offer.GetHostname(), taskToSchedule.GetTaskId().GetValue()).Log(SCHED_TRACE, log.InfoLevel, "")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogTerminateScheduler() {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "Done scheduling all tasks!")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Done scheduling all tasks!")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogInsufficientResourcesDeclineOffer(offer *mesos.Offer,
|
||||
offerResources ...interface{}) {
|
||||
buffer := bytes.Buffer{}
|
||||
buffer.WriteString(fmt.Sprintf("<CPU: %f, RAM: %f, Watts: %f>", offerResources...))
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Offer Resources": fmt.Sprintf("%s", buffer.String())}).Log(elekLogTypes.CONSOLE,
|
||||
elekLog.WithField("Offer Resources", buffer.String()).Log(CONSOLE,
|
||||
log.WarnLevel, "DECLINING OFFER... Offer has insufficient resources to launch a task")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogOfferRescinded(offerID *mesos.OfferID) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"OfferID": fmt.Sprintf("%s", offerID)}).Log(elekLogTypes.CONSOLE,
|
||||
log.ErrorLevel, "OFFER RESCINDED")
|
||||
elekLog.WithField("OfferID", *offerID.Value).Log(CONSOLE, log.ErrorLevel, "OFFER RESCINDED")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogSlaveLost(slaveID *mesos.SlaveID) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"SlaveID": fmt.Sprintf("%s", slaveID)}).Log(elekLogTypes.CONSOLE,
|
||||
log.ErrorLevel, "SLAVE LOST")
|
||||
elekLog.WithField("SlaveID", *slaveID.Value).Log(CONSOLE, log.ErrorLevel, "SLAVE LOST")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogExecutorLost(executorID *mesos.ExecutorID, slaveID *mesos.SlaveID) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"ExecutorID": fmt.Sprintf("%s", executorID), "SlaveID": fmt.Sprintf("%s", slaveID)}).Log(elekLogTypes.CONSOLE, log.ErrorLevel, "EXECUTOR LOST")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"ExecutorID": *executorID.Value,
|
||||
"SlaveID": *slaveID.Value,
|
||||
}).Log(CONSOLE, log.ErrorLevel, "EXECUTOR LOST")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogFrameworkMessage(executorID *mesos.ExecutorID,
|
||||
slaveID *mesos.SlaveID, message string) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Received Framework message from executor": executorID}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, message)
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel, "Received Framework message from executor %v", executorID)
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogMesosError(err string) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"MESOS CONSOLE": fmt.Sprintf("%v", err)}).Log(elekLogTypes.CONSOLE,
|
||||
log.ErrorLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.ErrorLevel, "MESOS CONSOLE %v", err)
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogElectronError(err error) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"ELECTRON CONSOLE": fmt.Sprintf("%v", err)}).Log(elekLogTypes.CONSOLE, log.ErrorLevel, "")
|
||||
elekLog.Logf(CONSOLE, log.ErrorLevel, "ELEKTRON CONSOLE %v", err)
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogFrameworkRegistered(frameworkID *mesos.FrameworkID,
|
||||
masterInfo *mesos.MasterInfo) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"frameworkID": fmt.Sprintf("%s", frameworkID), "master": fmt.Sprintf("%v", masterInfo)}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "FRAMEWORK REGISTERED!")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"frameworkID": *frameworkID.Value,
|
||||
"master": fmt.Sprintf("%v", masterInfo),
|
||||
}).Log(CONSOLE, log.InfoLevel, "FRAMEWORK REGISTERED!")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogFrameworkReregistered(masterInfo *mesos.MasterInfo) {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"master": fmt.Sprintf("%v", masterInfo)}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "Framework re-registered")
|
||||
elekLog.WithField("master", fmt.Sprintf("%v", masterInfo)).Log(CONSOLE, log.InfoLevel, "Framework re-registered")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogDisconnected() {
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.WarnLevel, "Framework disconnected with master")
|
||||
elekLog.Log(CONSOLE, log.WarnLevel, "Framework disconnected with master")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogTaskStatusUpdate(status *mesos.TaskStatus) {
|
||||
|
@ -356,12 +359,15 @@ func (s *BaseScheduler) LogTaskStatusUpdate(status *mesos.TaskStatus) {
|
|||
default:
|
||||
level = log.InfoLevel
|
||||
}
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"task": fmt.Sprintf("%s", *status.TaskId.Value), "state": NameFor(status.State)}).Log(elekLogTypes.CONSOLE, level, "Task Status received")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"task": *status.TaskId.Value,
|
||||
"state": NameFor(status.State),
|
||||
}).Log(CONSOLE, level, "Task Status received")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogSchedPolicySwitch(name string, nextPolicy SchedPolicyState) {
|
||||
logSPS := func() {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Name": name}).Log(elekLogTypes.SPS, log.InfoLevel, "")
|
||||
elekLog.WithField("Name", name).Log(SPS, log.InfoLevel, "")
|
||||
}
|
||||
if s.hasReceivedResourceOffers && (s.curSchedPolicy != nextPolicy) {
|
||||
logSPS()
|
||||
|
@ -370,10 +376,13 @@ func (s *BaseScheduler) LogSchedPolicySwitch(name string, nextPolicy SchedPolicy
|
|||
}
|
||||
// Logging the size of the scheduling window and the scheduling policy
|
||||
// that is going to schedule the tasks in the scheduling window.
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Window size": fmt.Sprintf("%d", s.schedWindowSize), "Name": name}).Log(elekLogTypes.SCHED_WINDOW, log.InfoLevel, "")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"Window size": fmt.Sprintf("%d", s.schedWindowSize),
|
||||
"Name": name,
|
||||
}).Log(SCHED_WINDOW, log.InfoLevel, "")
|
||||
}
|
||||
|
||||
func (s *BaseScheduler) LogClsfnAndTaskDistOverhead(overhead time.Duration) {
|
||||
// Logging the overhead in microseconds.
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Overhead in microseconds": fmt.Sprintf("%f", float64(overhead.Nanoseconds())/1000.0)}).Log(elekLogTypes.CLSFN_TASKDISTR_OVERHEAD, log.InfoLevel, "")
|
||||
elekLog.WithField("Overhead in microseconds", fmt.Sprintf("%f", float64(overhead.Nanoseconds())/1000.0)).Log(CLSFN_TASKDISTR_OVERHEAD, log.InfoLevel, "")
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/constants"
|
||||
"github.com/spdfg/elektron/def"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
"github.com/spdfg/elektron/utilities"
|
||||
"github.com/spdfg/elektron/utilities/mesosUtils"
|
||||
)
|
||||
|
@ -36,10 +36,10 @@ import (
|
|||
func coLocated(tasks map[string]bool, s BaseScheduler) {
|
||||
|
||||
for _, task := range tasks {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Task": task}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "")
|
||||
elekLog.WithField("Task", fmt.Sprintf("%v", task)).Log(CONSOLE, log.InfoLevel, "")
|
||||
}
|
||||
|
||||
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.InfoLevel, "---------------------")
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "---------------------")
|
||||
}
|
||||
|
||||
// Get the powerClass of the given hostname.
|
||||
|
|
|
@ -26,8 +26,8 @@ import (
|
|||
sched "github.com/mesos/mesos-go/api/v0/scheduler"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/def"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
)
|
||||
|
||||
type SchedPolicyContext interface {
|
||||
|
@ -90,8 +90,7 @@ func switchTaskDistBased(baseSchedRef *BaseScheduler) string {
|
|||
// Determine the distribution of tasks in the new scheduling window.
|
||||
taskDist, err := def.GetTaskDistributionInWindow(baseSchedRef.schedWindowSize, baseSchedRef.tasks)
|
||||
baseSchedRef.LogClsfnAndTaskDistOverhead(time.Now().Sub(startTime))
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Task Distribution": fmt.Sprintf("%f", taskDist)}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "Switching... ")
|
||||
elekLog.WithField("Task Distribution", fmt.Sprintf("%f", taskDist)).Log(CONSOLE, log.InfoLevel, "Switching... ")
|
||||
if err != nil {
|
||||
// All the tasks in the window were only classified into 1 cluster.
|
||||
// Max-Min and Max-GreedyMins would work the same way as Bin-Packing for this situation.
|
||||
|
@ -219,9 +218,11 @@ func (bsps *baseSchedPolicyState) SwitchIfNecessary(spc SchedPolicyContext) {
|
|||
switchToPolicyName = switchBasedOn[baseSchedRef.schedPolSwitchCriteria](baseSchedRef)
|
||||
} else {
|
||||
// We continue working with the currently deployed scheduling policy.
|
||||
log.Println("Continuing with the current scheduling policy...")
|
||||
log.Printf("TasksScheduled[%d], SchedWindowSize[%d]", bsps.numTasksScheduled,
|
||||
baseSchedRef.schedWindowSize)
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Continuing with the current scheduling policy...")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"TasksScheduled": fmt.Sprintf("%d", bsps.numTasksScheduled),
|
||||
"SchedWindowSize": fmt.Sprintf("%d", baseSchedRef.schedWindowSize),
|
||||
}).Log(CONSOLE, log.InfoLevel, "")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -233,9 +234,11 @@ func (bsps *baseSchedPolicyState) SwitchIfNecessary(spc SchedPolicyContext) {
|
|||
bsps.numTasksScheduled = 0
|
||||
} else {
|
||||
// We continue working with the currently deployed scheduling policy.
|
||||
log.Println("Continuing with the current scheduling policy...")
|
||||
log.Printf("TasksScheduled[%d], SchedWindowSize[%d]", bsps.numTasksScheduled,
|
||||
baseSchedRef.schedWindowSize)
|
||||
elekLog.Log(CONSOLE, log.InfoLevel, "Continuing with the current scheduling policy...")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"TasksScheduled": fmt.Sprintf("%d", bsps.numTasksScheduled),
|
||||
"SchedWindowSize": fmt.Sprintf("%d", baseSchedRef.schedWindowSize),
|
||||
}).Log(CONSOLE, log.InfoLevel, "")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import (
|
|||
mesos "github.com/mesos/mesos-go/api/v0/mesosproto"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/constants"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
)
|
||||
|
||||
func OfferAgg(offer *mesos.Offer) (float64, float64, float64) {
|
||||
|
@ -90,13 +90,15 @@ func UpdateEnvironment(offer *mesos.Offer) {
|
|||
var host = offer.GetHostname()
|
||||
// If this host is not present in the set of hosts.
|
||||
if _, ok := constants.Hosts[host]; !ok {
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"Adding host": host}).Log(elekLogTypes.CONSOLE, log.InfoLevel, "New host detected")
|
||||
elekLog.WithField("host", host).Log(CONSOLE, log.InfoLevel, "New host detected")
|
||||
// Add this host.
|
||||
constants.Hosts[host] = struct{}{}
|
||||
// Get the power class of this host.
|
||||
class := PowerClass(offer)
|
||||
elekLog.ElektronLogger.WithFields(log.Fields{"host": host, "PowerClass": class}).Log(elekLogTypes.CONSOLE,
|
||||
log.InfoLevel, "Registering the power class...")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"host": host,
|
||||
"PowerClass": class,
|
||||
}).Log(CONSOLE, log.InfoLevel, "Registering the power class...")
|
||||
// If new power class, register the power class.
|
||||
if _, ok := constants.PowerClasses[class]; !ok {
|
||||
constants.PowerClasses[class] = make(map[string]struct{})
|
||||
|
|
|
@ -21,8 +21,8 @@ package schedUtils
|
|||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spdfg/elektron/def"
|
||||
elekLog "github.com/spdfg/elektron/elektronLogging"
|
||||
elekLogTypes "github.com/spdfg/elektron/elektronLogging/types"
|
||||
elekLog "github.com/spdfg/elektron/logging"
|
||||
. "github.com/spdfg/elektron/logging/types"
|
||||
"github.com/spdfg/elektron/utilities"
|
||||
)
|
||||
|
||||
|
@ -78,7 +78,7 @@ func (s *fillNextOfferCycle) apply(taskQueue []def.Task) (int, int) {
|
|||
for _, task := range taskQueue {
|
||||
numberOfTasksTraversed++
|
||||
for i := *task.Instances; i > 0; i-- {
|
||||
elekLog.ElektronLogger.Logf(elekLogTypes.CONSOLE, log.InfoLevel,
|
||||
elekLog.Logf(CONSOLE, log.InfoLevel,
|
||||
"Checking if Instance #%d of Task[%s] can be scheduled "+
|
||||
"during the next offer cycle...", i, task.Name)
|
||||
if canSchedule(task) {
|
||||
|
|
I would alias this to elekLog as you seem to be using that prefix when aliasing imports of sub-packages.