mirror of
https://github.com/Kyren223/eko.git
synced 2025-09-05 21:18:14 +00:00
Client logs are now stored in the cache dir
This commit is contained in:
@@ -18,7 +18,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
@@ -42,12 +41,5 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logFile, err := os.OpenFile("client.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalln(err)
|
|
||||||
}
|
|
||||||
defer logFile.Close()
|
|
||||||
log.SetOutput(logFile)
|
|
||||||
|
|
||||||
client.Run()
|
client.Run()
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -46,15 +47,6 @@ func (c BubbleTeaCloser) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Run() {
|
func Run() {
|
||||||
var dump *os.File
|
|
||||||
if ui.DEBUG {
|
|
||||||
var err error
|
|
||||||
dump, err = os.OpenFile("messages.log", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o600)
|
|
||||||
if err != nil {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Println("client started")
|
log.Println("client started")
|
||||||
|
|
||||||
err := config.LoadConfig()
|
err := config.LoadConfig()
|
||||||
@@ -68,6 +60,20 @@ func Run() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logPath := path.Join(config.CacheDir, "client.log")
|
||||||
|
logFile, err := os.OpenFile(logPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600) // #nosec G304
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
defer logFile.Close()
|
||||||
|
log.SetOutput(logFile)
|
||||||
|
|
||||||
|
dumpPath := path.Join(config.CacheDir, "messages.log")
|
||||||
|
dump, err := os.OpenFile(dumpPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o600) // #nosec G304
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
program := tea.NewProgram(initialModel(dump), tea.WithAltScreen())
|
program := tea.NewProgram(initialModel(dump), tea.WithAltScreen())
|
||||||
assert.AddFlush(BubbleTeaCloser{program})
|
assert.AddFlush(BubbleTeaCloser{program})
|
||||||
ui.Program = program
|
ui.Program = program
|
||||||
|
@@ -34,8 +34,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DEBUG = true
|
|
||||||
|
|
||||||
MinWidth = 85
|
MinWidth = 85
|
||||||
MinHeight = 25
|
MinHeight = 25
|
||||||
Center lipgloss.Position = 0.499
|
Center lipgloss.Position = 0.499
|
||||||
|
@@ -6,8 +6,8 @@ procs:
|
|||||||
client-secondary:
|
client-secondary:
|
||||||
shell: "go run ./cmd/client"
|
shell: "go run ./cmd/client"
|
||||||
client-log:
|
client-log:
|
||||||
shell: "tail -f client.log"
|
shell: "tail -f $HOME/.cache/eko/client.log"
|
||||||
messages-log:
|
messages-log:
|
||||||
shell: "tail -f messages.log"
|
shell: "tail -f $HOME/.cache/eko/messages.log"
|
||||||
check-ci:
|
check-ci:
|
||||||
shell: "./tools/check-ci.sh"
|
shell: "./tools/check-ci.sh"
|
||||||
|
Reference in New Issue
Block a user