diff --git a/logger/log.go b/logger/log.go new file mode 100644 index 0000000..e02732a --- /dev/null +++ b/logger/log.go @@ -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) +} diff --git a/main.go b/main.go index e379a73..3d512b5 100644 --- a/main.go +++ b/main.go @@ -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() } @@ -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) } -} \ No newline at end of file +}