Skip to content

Commit

Permalink
feat: logger initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakiyo committed Aug 22, 2023
1 parent 657fc63 commit ccce335
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions logger/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package logger

import (
"os"

"github.com/charmbracelet/log"
)

// initialization of logger
func Init() {
// set log level to warn
log.SetLevel(log.WarnLevel)

log.SetReportTimestamp(false)
log.SetOutput(os.Stderr)
}
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ package main

import (
"github.com/Yakiyo/tilde/cmd"
"github.com/Yakiyo/tilde/logger"
"github.com/charmbracelet/log"
)

func main() {
defer panicHandler()

logger.Init()

cmd.Execute()
}

Expand All @@ -18,4 +21,4 @@ func panicHandler() {
log.Error("Unhandled error cause panic. Please consider filing a bug at https://github.com/Yakiyo/tilde")
log.Fatal(err)
}
}
}

0 comments on commit ccce335

Please # to comment.