added log history
This commit is contained in:
+19
-7
@@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
@@ -201,14 +202,25 @@ type Credentials struct {
|
||||
|
||||
type Log struct {
|
||||
Model
|
||||
Alias string `json:"alias,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Dtlog time.Time `json:"dtlog"`
|
||||
Data []byte `json:"data,omitempty"`
|
||||
Err string `json:"err,omitempty"`
|
||||
Stack []byte `json:"stack,omitempty"`
|
||||
Alias string `json:"alias,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Dtlog time.Time `json:"dtlog"`
|
||||
Dtlogend time.Time `json:"dtlogend"`
|
||||
Data []byte `json:"data,omitempty"`
|
||||
Err string `json:"err,omitempty"`
|
||||
History string `json:"history,omitempty"`
|
||||
}
|
||||
|
||||
func (l *Log) AddHistory(s string) {
|
||||
s = fmt.Sprintf("* %s: %s", time.Now().Format("02/01/06 - 15:04:05"), s)
|
||||
if l.History == "" {
|
||||
l.History = s
|
||||
} else {
|
||||
l.History = l.History + "\n" + s
|
||||
}
|
||||
}
|
||||
|
||||
type LogQuery struct {
|
||||
From time.Time `json:"from"`
|
||||
Until time.Time `json:"until"`
|
||||
|
||||
Reference in New Issue
Block a user