This commit is contained in:
Suyono 2023-09-05 14:22:36 +10:00
parent a5a019b28b
commit 1f25e5249c
3 changed files with 12 additions and 5 deletions

View File

@ -2,12 +2,16 @@ package daemon
import ( import (
"fmt" "fmt"
"io"
"gitea.suyono.dev/suyono/wingmate/config" "gitea.suyono.dev/suyono/wingmate/config"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
type service struct { type service struct {
name string name string
stdoutLogWriter io.WriteCloser
stderrLogWriter io.WriteCloser
logChannel chan<- any logChannel chan<- any
errChannel chan<- error errChannel chan<- error
} }
@ -15,6 +19,7 @@ type service struct {
func newService(name string, error chan<- error, logging chan<- any) *service { func newService(name string, error chan<- error, logging chan<- any) *service {
return &service{ return &service{
name: name, name: name,
// stdoutLogWriter: log.NewLogFile(fmt.Sprintf("%s.%s.%s", Service.String(), name, config.CommandKey)),
logChannel: logging, logChannel: logging,
errChannel: error, errChannel: error,
} }

View File

@ -22,6 +22,8 @@ const (
Error Level = Level(zerolog.ErrorLevel) Error Level = Level(zerolog.ErrorLevel)
Fatal Level = Level(zerolog.FatalLevel) Fatal Level = Level(zerolog.FatalLevel)
Panic Level = Level(zerolog.PanicLevel) Panic Level = Level(zerolog.PanicLevel)
LogKey = "log"
) )
var ( var (

View File

@ -46,6 +46,6 @@ func (f *File) Close() error {
} }
func (f *File) Rotate() error { func (f *File) Rotate() error {
//TODO: implement log rotation
return nil return nil
} }