From 5766e86595bb7bc4c16c37f8ed47bcf0db25d82b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 28 Dec 2023 12:35:05 -0600 Subject: [PATCH] initial commit Signed-off-by: Jeff Carr --- error.go | 9 +++++++++ info.go | 23 +++++++++++++++++++++++ log.go | 9 +++++++++ warn.go | 9 +++++++++ 4 files changed, 50 insertions(+) create mode 100644 error.go create mode 100644 info.go create mode 100644 log.go create mode 100644 warn.go diff --git a/error.go b/error.go new file mode 100644 index 0000000..95c6cc3 --- /dev/null +++ b/error.go @@ -0,0 +1,9 @@ +package log + +import ( + origlog "log" +) + +func Error(a ...any) { + origlog.Println(a...) +} diff --git a/info.go b/info.go new file mode 100644 index 0000000..b390062 --- /dev/null +++ b/info.go @@ -0,0 +1,23 @@ +package log + +import ( + "os" + golanglog "log" +) + +func Info(a ...any) { + golanglog.Println(a...) +} + +// start writing all the logging to a tmp file +func SetTmp() { + f, err := os.OpenFile("/tmp/guilogfile", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666) + if err != nil { + golanglog.Fatalf("error opening file: %v", err) + } + // hmm. is there a trick here or must this be in main() + // defer f.Close() + + golanglog.SetOutput(f) + golanglog.Println("This is a test log entry") +} diff --git a/log.go b/log.go new file mode 100644 index 0000000..e294b73 --- /dev/null +++ b/log.go @@ -0,0 +1,9 @@ +package log + +import ( + origlog "log" +) + +func Println(a ...any) { + origlog.Println(a...) +} diff --git a/warn.go b/warn.go new file mode 100644 index 0000000..75d466c --- /dev/null +++ b/warn.go @@ -0,0 +1,9 @@ +package log + +import ( + origlog "log" +) + +func Warn(a ...any) { + origlog.Println(a...) +}