Logging Web Interface
**Work in progress**
This commit is contained in:
1 parent
838dbb8265
commit
df6121c629
3 files changed
+46
-1
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package DeviceDatabase
|
||||
|
||||
import (
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
)
|
||||
|
||||
func ReadLatest() (events []LogDBEntry) {
|
||||
|
||||
query := logDBCollection.Find().Sort(`TimeUTC`).Limit(26)
|
||||
count := 26
|
||||
|
||||
if n, err := query.Count(); err == nil {
|
||||
count = n
|
||||
}
|
||||
|
||||
iter := query.Iter()
|
||||
entry := LogDBEntry{}
|
||||
pos := 0
|
||||
events = make([]LogDBEntry, count)
|
||||
|
||||
for iter.Next(&entry) {
|
||||
events[pos] = entry
|
||||
pos++
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -10,7 +10,7 @@ type Database struct {
|
||||
func (dev Database) Log(entries []Meta.Entry) {
|
||||
|
||||
//
|
||||
// Can not log here to prevent endless loop (consumer is also producer)
|
||||
// Cannot log here to prevent endless loop (consumer is also producer)
|
||||
//
|
||||
|
||||
write2Cache(entries)
|
||||
|
||||
Reference in new issue
Block a user