1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-400 Logger extracted to new config format

This commit is contained in:
Chris Cummer
2019-04-15 20:29:45 -07:00
parent fea83a38b2
commit 8bc217e9a1
4 changed files with 27 additions and 7 deletions

View File

@@ -2,7 +2,6 @@ package logger
import (
"fmt"
//"io/ioutil"
"log"
"os"
"path/filepath"
@@ -18,13 +17,15 @@ type Widget struct {
wtf.TextWidget
filePath string
settings *Settings
}
func NewWidget(app *tview.Application) *Widget {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, "Logs", "logger", true),
filePath: logFilePath(),
settings: settings,
}
return &widget

20
logger/settings.go Normal file
View File

@@ -0,0 +1,20 @@
package logger
import (
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
)
type Settings struct {
common *cfg.Common
filePath string
}
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
}
return &settings
}