WIP : Elektron Logging library #16

Merged
balandi1 merged 50 commits from master into master 2019-12-10 01:15:34 +00:00
7 changed files with 26 additions and 16 deletions
Showing only changes of commit 02abb1e882 - Show all commits

View file

@ -45,7 +45,7 @@ func newClsfnTaskDistrOverheadLogger(
func (cLog clsfnTaskDistrOverheadLogger) Log(logType int, level log.Level, message string) {
if cLog.logType == logType {
if cLog.isEnabled() {
if cLog.config.AllowOnConsole {
if cLog.isAllowedOnConsole() {
cLog.logger.SetOutput(os.Stdout)
cLog.logger.WithFields(cLog.data).Log(level, message)
}
@ -66,7 +66,7 @@ func (cLog clsfnTaskDistrOverheadLogger) Log(logType int, level log.Level, messa
func (cLog clsfnTaskDistrOverheadLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
if cLog.logType == logType {
if cLog.isEnabled() {
if cLog.config.AllowOnConsole {
if cLog.isAllowedOnConsole() {
cLog.logger.SetOutput(os.Stdout)
cLog.logger.WithFields(cLog.data).Logf(level, msgFmtString, args...)
}
@ -86,7 +86,7 @@ func (cLog clsfnTaskDistrOverheadLogger) Logf(logType int, level log.Level, msgF
func (cLog *clsfnTaskDistrOverheadLogger) createLogFile(prefix string) {
if cLog.isEnabled() {
filename := strings.Join([]string{prefix, cLog.config.FilenameExtension}, "")
filename := strings.Join([]string{prefix, cLog.getFilenameExtension()}, "")
dirName := cLog.logDir.getDirName()
if dirName != "" {
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {

View file

@ -86,7 +86,7 @@ func (cLog consoleLogger) Logf(logType int, level log.Level, msgFmtString string
func (cLog *consoleLogger) createLogFile(prefix string) {
// Create log file for the type if it is enabled.
if cLog.isEnabled() {
filename := strings.Join([]string{prefix, cLog.config.FilenameExtension}, "")
filename := strings.Join([]string{prefix, cLog.getFilenameExtension()}, "")
dirName := cLog.logDir.getDirName()
fmt.Println(dirName)
if dirName != "" {

View file

@ -17,6 +17,8 @@ var elektronLoggerInstance elektronLogger
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
type elektronLogger interface {
setNext(next elektronLogger)
isEnabled() bool
isAllowedOnConsole() bool
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
getFilenameExtension() string
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
Log(logType int, level log.Level, message string)
Logf(logType int, level log.Level, msgFmtString string, args ...interface{})
WithFields(logData log.Fields) elektronLogger
@ -47,6 +49,14 @@ func (l baseElektronLogger) isEnabled() bool {
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
return l.config.Enabled
}
func (l baseElektronLogger) isAllowedOnConsole() bool {
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
return l.config.AllowOnConsole
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
}
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
func (l baseElektronLogger) getFilenameExtension() string {
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
return l.config.FilenameExtension
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
}
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
func (l *baseElektronLogger) WithFields(logData log.Fields) elektronLogger {
l.data = logData
return l

pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done
pradykaushik commented 2019-12-06 22:03:56 +00:00 (Migrated from github.com)

isEnabled() does not have to be part of the interface.

`isEnabled()` does not have to be part of the interface.
pradykaushik commented 2019-12-06 22:04:02 +00:00 (Migrated from github.com)

ditto

ditto
pradykaushik commented 2019-12-06 22:04:11 +00:00 (Migrated from github.com)

ditto

ditto
balandi1 commented 2019-12-09 15:41:29 +00:00 (Migrated from github.com)

Yes. Removed it from there

Yes. Removed it from there
balandi1 commented 2019-12-09 15:42:13 +00:00 (Migrated from github.com)

Done

Done
balandi1 commented 2019-12-09 15:42:23 +00:00 (Migrated from github.com)

Done

Done

View file

@ -46,7 +46,7 @@ func newPCPLogger(
func (pLog pcpLogger) Log(logType int, level log.Level, message string) {
if pLog.logType == logType {
if pLog.isEnabled() {
if pLog.config.AllowOnConsole {
if pLog.isAllowedOnConsole() {
pLog.logger.SetOutput(os.Stdout)
pLog.logger.WithFields(pLog.data).Log(level, message)
}
@ -66,7 +66,7 @@ func (pLog pcpLogger) Log(logType int, level log.Level, message string) {
func (pLog pcpLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
if pLog.logType == logType {
if pLog.isEnabled() {
if pLog.config.AllowOnConsole {
if pLog.isAllowedOnConsole() {
pLog.logger.SetOutput(os.Stdout)
pLog.logger.WithFields(pLog.data).Logf(level, msgFmtString, args...)
}
@ -86,7 +86,7 @@ func (pLog pcpLogger) Logf(logType int, level log.Level, msgFmtString string, ar
func (pLog *pcpLogger) createLogFile(prefix string) {
if pLog.isEnabled() {
filename := strings.Join([]string{prefix, pLog.config.FilenameExtension}, "")
filename := strings.Join([]string{prefix, pLog.getFilenameExtension()}, "")
dirName := pLog.logDir.getDirName()
if dirName != "" {
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {

View file

@ -46,7 +46,7 @@ func newSchedPolicySwitchLogger(
func (sLog schedPolicySwitchLogger) Log(logType int, level log.Level, message string) {
if sLog.logType == logType {
if sLog.isEnabled() {
if sLog.config.AllowOnConsole {
if sLog.isAllowedOnConsole() {
sLog.logger.SetOutput(os.Stdout)
sLog.logger.WithFields(sLog.data).Log(level, message)
}
@ -66,7 +66,7 @@ func (sLog schedPolicySwitchLogger) Log(logType int, level log.Level, message st
func (sLog schedPolicySwitchLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
if sLog.logType == logType {
if sLog.isEnabled() {
if sLog.config.AllowOnConsole {
if sLog.isAllowedOnConsole() {
sLog.logger.SetOutput(os.Stdout)
sLog.logger.WithFields(sLog.data).Logf(level, msgFmtString, args...)
}
@ -86,7 +86,7 @@ func (sLog schedPolicySwitchLogger) Logf(logType int, level log.Level, msgFmtStr
func (sLog *schedPolicySwitchLogger) createLogFile(prefix string) {
if sLog.isEnabled() {
filename := strings.Join([]string{prefix, sLog.config.FilenameExtension}, "")
filename := strings.Join([]string{prefix, sLog.getFilenameExtension()}, "")
dirName := sLog.logDir.getDirName()
if dirName != "" {
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {

View file

@ -46,7 +46,7 @@ func newSchedTraceLogger(
func (sLog schedTraceLogger) Log(logType int, level log.Level, message string) {
if sLog.logType == logType {
if sLog.isEnabled() {
if sLog.config.AllowOnConsole {
if sLog.isAllowedOnConsole() {
sLog.logger.SetOutput(os.Stdout)
sLog.logger.WithFields(sLog.data).Log(level, message)
}
@ -66,7 +66,7 @@ func (sLog schedTraceLogger) Log(logType int, level log.Level, message string) {
func (sLog schedTraceLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
if sLog.logType == logType {
if sLog.isEnabled() {
if sLog.config.AllowOnConsole {
if sLog.isAllowedOnConsole() {
sLog.logger.SetOutput(os.Stdout)
sLog.logger.WithFields(sLog.data).Logf(level, msgFmtString, args...)
}
@ -86,7 +86,7 @@ func (sLog schedTraceLogger) Logf(logType int, level log.Level, msgFmtString str
func (sLog *schedTraceLogger) createLogFile(prefix string) {
if sLog.isEnabled() {
filename := strings.Join([]string{prefix, sLog.config.FilenameExtension}, "")
filename := strings.Join([]string{prefix, sLog.getFilenameExtension()}, "")
dirName := sLog.logDir.getDirName()
if dirName != "" {
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {

View file

@ -46,7 +46,7 @@ func newSchedWindowLogger(
func (sLog schedWindowLogger) Log(logType int, level log.Level, message string) {
if sLog.logType == logType {
if sLog.isEnabled() {
if sLog.config.AllowOnConsole {
if sLog.isAllowedOnConsole() {
sLog.logger.SetOutput(os.Stdout)
sLog.logger.WithFields(sLog.data).Log(level, message)
}
@ -67,7 +67,7 @@ func (sLog schedWindowLogger) Log(logType int, level log.Level, message string)
func (sLog schedWindowLogger) Logf(logType int, level log.Level, msgFmtString string, args ...interface{}) {
if sLog.logType == logType {
if sLog.isEnabled() {
if sLog.config.AllowOnConsole {
if sLog.isAllowedOnConsole() {
sLog.logger.SetOutput(os.Stdout)
sLog.logger.WithFields(sLog.data).Logf(level, msgFmtString, args...)
}
@ -86,7 +86,7 @@ func (sLog schedWindowLogger) Logf(logType int, level log.Level, msgFmtString st
func (sLog *schedWindowLogger) createLogFile(prefix string) {
if sLog.isEnabled() {
filename := strings.Join([]string{prefix, sLog.config.FilenameExtension}, "")
filename := strings.Join([]string{prefix, sLog.getFilenameExtension()}, "")
dirName := sLog.logDir.getDirName()
if dirName != "" {
if logFile, err := os.Create(filepath.Join(dirName, filename)); err != nil {