added log table

nats
Paulo Simão 2021-10-11 14:53:32 -03:00
parent d06e5bceae
commit 8fb8bb502e
2 changed files with 19 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package replay
import ( import (
"fmt" "fmt"
"os" "os"
"time"
"go.digitalcircle.com.br/open/replaycli-go/api" "go.digitalcircle.com.br/open/replaycli-go/api"
"go.digitalcircle.com.br/open/replaycli-go/types" "go.digitalcircle.com.br/open/replaycli-go/types"
@ -13,6 +14,11 @@ type Cli struct {
*api.ApiCli *api.ApiCli
} }
func (c *Cli) Log(l *types.Log) error {
l.Alias = c.ReplayEnvAlias()
l.Dtlog = time.Now()
return c.HttpCli().JsonPost("/api/v1/log", l, nil)
}
func (c *Cli) ReplayEnvQueueId() string { func (c *Cli) ReplayEnvQueueId() string {
return os.Getenv("REPLAY_QUEUEID") return os.Getenv("REPLAY_QUEUEID")
} }

View File

@ -201,7 +201,19 @@ type Credentials struct {
type Log struct { type Log struct {
Model Model
Log []byte Alias string
Title string
Tags string
Dtlog time.Time
Data []byte
}
type LogQuery struct {
From time.Time `json:"from"`
Until time.Time `json:"until"`
Limit int `json:"limit"`
Title string `json:"title"`
Alias string `json:"alias"`
Tags string `json:"tags"`
} }
type Job struct { type Job struct {