added system log

main
alex 2023-09-16 11:35:04 +02:00
parent e10510b56c
commit c9b50db0d1
2 changed files with 16 additions and 14 deletions

View File

@ -178,10 +178,10 @@ func CheckForDeletableLogs() {
logFolder := config.Cfg.LogFolder logFolder := config.Cfg.LogFolder
err := filepath.Walk(logFolder, func(path string, info os.FileInfo, err error) error { err := filepath.Walk(logFolder, func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return err return err
} }
if !info.IsDir() { if !info.IsDir() {
// check if the file is older than the daysToKeepLogs // check if the file is older than the daysToKeepLogs
@ -212,15 +212,15 @@ func CheckForDeletableLogs() {
AddLog(structs.LogBody{ AddLog(structs.LogBody{
Type: "system", Type: "system",
Logs: []string{"I "+ utils.GetTime() + "LogManager: Deleted log file " + path + " because it was older than " + strconv.Itoa(daysToKeepLogs) + " days."}, Logs: []string{"I " + utils.GetTime() + "LogManager: Deleted log file " + path + " because it was older than " + strconv.Itoa(daysToKeepLogs) + " days."},
}) })
} }
} }
return nil return nil
}) })
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} }
} }

View File

@ -1,6 +1,8 @@
package structs package structs
import "github.com/google/uuid" import (
"github.com/google/uuid"
)
type SSEClient struct { type SSEClient struct {
MessageChannel chan SSEClientChannelMessage MessageChannel chan SSEClientChannelMessage