Added settings, proper record renaming
This commit is contained in:
parent
2ae93b6fd4
commit
7d7c0c9570
10 changed files with 444 additions and 85 deletions
31
main.go
31
main.go
|
|
@ -26,7 +26,7 @@ var (
|
|||
device RouterosDevice
|
||||
)
|
||||
|
||||
func init() {// {{{
|
||||
func init() { // {{{
|
||||
initLogger = slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{}))
|
||||
|
||||
confDir, err := os.UserConfigDir()
|
||||
|
|
@ -49,23 +49,26 @@ func init() {// {{{
|
|||
}
|
||||
|
||||
logger = initLogging(config)
|
||||
}// }}}
|
||||
func initLogging(config Config) (*slog.Logger) {// {{{
|
||||
} // }}}
|
||||
func initLogging(config Config) *slog.Logger { // {{{
|
||||
opts := slog.HandlerOptions{}
|
||||
if flagDebug {
|
||||
opts.Level = slog.LevelDebug
|
||||
handler := slog.NewJSONHandler(os.Stdout, &opts)
|
||||
return slog.New(handler)
|
||||
} else {
|
||||
handler := vlog.New(
|
||||
os.Stdout,
|
||||
opts,
|
||||
config.Logging.LogDir,
|
||||
config.Logging.URL,
|
||||
"routeros-dns",
|
||||
config.Logging.System,
|
||||
config.Logging.Instance,
|
||||
)
|
||||
return slog.New(handler)
|
||||
}
|
||||
handler := vlog.New(
|
||||
os.Stdout,
|
||||
opts,
|
||||
config.Logging.LogDir,
|
||||
config.Logging.URL,
|
||||
"routeros-dns",
|
||||
config.Logging.System,
|
||||
config.Logging.Instance,
|
||||
)
|
||||
return slog.New(handler)
|
||||
}// }}}
|
||||
} // }}}
|
||||
|
||||
func main() {
|
||||
initLogger.Info("application", "version", VERSION)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue