Implemented the logging viewer
This commit is contained in:
1 parent
37c901636c
commit
3257fe2f32
10 files changed
+78
-26
No files matched your search
@@ -42,7 +42,7 @@ func HandlerWebLog(response http.ResponseWriter, request *http.Request) {
|
||||
// To less parameters?
|
||||
if countParameters < 9 {
|
||||
// Initial view => first page (latest logs)
|
||||
data.Events = readLatest()
|
||||
data.Events, lastPageNumber = readLatest()
|
||||
data.SetLiveView = true
|
||||
data.CurrentPage = `1`
|
||||
data.LastPage = fmt.Sprintf("%d", lastPageNumber)
|
||||
@@ -66,7 +66,7 @@ func HandlerWebLog(response http.ResponseWriter, request *http.Request) {
|
||||
currentLiveView := request.FormValue(`LiveView`)
|
||||
|
||||
// Store the events for the template:
|
||||
data.Events = readCustom(currentTimeRange, currentLevel, currentCategory, currentImpact, currentSeverity, currentMessageName, currentSender, currentPage)
|
||||
data.Events, lastPageNumber = readCustom(currentTimeRange, currentLevel, currentCategory, currentImpact, currentSeverity, currentMessageName, currentSender, currentPage)
|
||||
|
||||
if strings.ToLower(currentLiveView) == `true` {
|
||||
data.SetLiveView = true
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
)
|
||||
|
||||
// Read a custom event range from the database.
|
||||
func readCustom(timeRange, logLevel, logCategory, logImpact, logSeverity, logMessageName, logSender, logPage string) (events []Scheme.LogEvent) {
|
||||
func readCustom(timeRange, logLevel, logCategory, logImpact, logSeverity, logMessageName, logSender, logPage string) (events []Scheme.LogEvent, numPages int) {
|
||||
|
||||
// Get the custom events:
|
||||
eventsFromDB := DeviceDatabase.ReadCustom(timeRange, logLevel, logCategory, logImpact, logSeverity, logMessageName, logSender, logPage)
|
||||
eventsFromDB, totalNumberPages := DeviceDatabase.ReadCustom(timeRange, logLevel, logCategory, logImpact, logSeverity, logMessageName, logSender, logPage)
|
||||
count := len(eventsFromDB)
|
||||
|
||||
// Array with all events, prepared for the website:
|
||||
@@ -32,5 +32,6 @@ func readCustom(timeRange, logLevel, logCategory, logImpact, logSeverity, logMes
|
||||
}
|
||||
}
|
||||
|
||||
numPages = totalNumberPages
|
||||
return
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
)
|
||||
|
||||
// Read the latest log events from the database
|
||||
func readLatest() (events []Scheme.LogEvent) {
|
||||
func readLatest() (events []Scheme.LogEvent, numPages int) {
|
||||
// Get the latest events from the database
|
||||
eventsFromDB := DeviceDatabase.ReadLatest()
|
||||
eventsFromDB, totalNumberPages := DeviceDatabase.ReadLatest()
|
||||
count := len(eventsFromDB)
|
||||
|
||||
// Array for the log events, prepared for the website:
|
||||
@@ -31,5 +31,6 @@ func readLatest() (events []Scheme.LogEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
numPages = totalNumberPages
|
||||
return
|
||||
}
|
||||
Reference in new issue
Block a user