Implemented the logging viewer
This commit is contained in:
1 parent
d925e85653
commit
71aa99a5e3
11 files changed
+250
-120
No files matched your search
@@ -0,0 +1,8 @@
|
||||
package Scheme
|
||||
|
||||
// Type for a log event
|
||||
type LogEvent struct {
|
||||
LogLine string
|
||||
LogLevel string // logwarn || logdebug || logerror || loginfo || logtalkative || logsecurity
|
||||
AB string // loga || logb
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package Scheme
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
)
|
||||
|
||||
// The type for the web logger viewer template
|
||||
type LoggingViewer struct {
|
||||
Title string
|
||||
SetLiveView bool
|
||||
CurrentLevel string
|
||||
CurrentTimeRange string
|
||||
CurrentCategory string
|
||||
CurrentImpact string
|
||||
CurrentSeverity string
|
||||
CurrentMessageName string
|
||||
CurrentSender string
|
||||
CurrentPage string
|
||||
MessageNames []MessageNames
|
||||
Sender []Sender
|
||||
Events []LogEvent
|
||||
}
|
||||
|
||||
// The type for the message names is necessary to be able to define a function on it.
|
||||
type MessageNames string
|
||||
|
||||
// The type for the senders is necessary to be able to define a function on it.
|
||||
type Sender string
|
||||
|
||||
// This function is used from the template to mark selected values. This is for the type MessageNames.
|
||||
func (lv MessageNames) IsSelected(field MessageNames, currentValue string) string {
|
||||
if string(field) == currentValue {
|
||||
return ` selected`
|
||||
} else {
|
||||
return ``
|
||||
}
|
||||
}
|
||||
|
||||
// This function is necessary to mark the HTML attribute as safe. Only then it is possible
|
||||
// to change plain HTML code.
|
||||
func (lv MessageNames) Safe(element string) template.HTMLAttr {
|
||||
return template.HTMLAttr(element)
|
||||
}
|
||||
|
||||
// This function is used from the template to mark selected values. This is for the type Sender.
|
||||
func (lv Sender) IsSelected(field Sender, currentValue string) string {
|
||||
if string(field) == currentValue {
|
||||
return ` selected`
|
||||
} else {
|
||||
return ``
|
||||
}
|
||||
}
|
||||
|
||||
// This function is necessary to mark the HTML attribute as safe. Only then it is possible
|
||||
// to change plain HTML code.
|
||||
func (lv Sender) Safe(element string) template.HTMLAttr {
|
||||
return template.HTMLAttr(element)
|
||||
}
|
||||
|
||||
// This function is used from the template to mark selected values.
|
||||
func (lv LoggingViewer) IsSelected(field, currentValue string) string {
|
||||
if field == currentValue {
|
||||
return ` selected`
|
||||
} else {
|
||||
return ``
|
||||
}
|
||||
}
|
||||
|
||||
// This function is necessary to mark the HTML attribute as safe. Only then it is possible
|
||||
// to change plain HTML code.
|
||||
func (lv LoggingViewer) Safe(element string) template.HTMLAttr {
|
||||
return template.HTMLAttr(element)
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package Scheme
|
||||
|
||||
// The type for the web logger viewer template
|
||||
type Viewer struct {
|
||||
Title string
|
||||
SetLiveView bool
|
||||
CurrentLevel string
|
||||
CurrentTimeRange string
|
||||
CurrentCategory string
|
||||
CurrentImpact string
|
||||
CurrentSeverity string
|
||||
CurrentMessageName string
|
||||
CurrentSender string
|
||||
CurrentPage string
|
||||
MessageNames []string
|
||||
Sender []string
|
||||
Events []LogEvent
|
||||
}
|
||||
|
||||
// Type for a log event
|
||||
type LogEvent struct {
|
||||
LogLine string
|
||||
LogLevel string // logwarn || logdebug || logerror || loginfo || logtalkative || logsecurity
|
||||
AB string // loga || logb
|
||||
}
|
||||
Reference in new issue
Block a user