From ccce33543080ef50dfc4c953b7f1739a9b80078e Mon Sep 17 00:00:00 2001 From: Yakiyo Date: Tue, 22 Aug 2023 15:57:12 +0000 Subject: [PATCH] feat: logger initialization --- logger/log.go | 16 ++++++++++++++++ main.go | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 logger/log.go 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 +}