diff --git a/nzx_tmpmail/go.mod b/nzx_tmpmail/go.mod new file mode 100644 index 0000000..4d3ea5e --- /dev/null +++ b/nzx_tmpmail/go.mod @@ -0,0 +1,3 @@ +module git.uwushka.cc/nzx056/nzx056/nzx_tmpmail + +go 1.25.4 diff --git a/nzx_tmpmail/loggingshit/log.go b/nzx_tmpmail/loggingshit/log.go new file mode 100644 index 0000000..8d71827 --- /dev/null +++ b/nzx_tmpmail/loggingshit/log.go @@ -0,0 +1,47 @@ +package loggingshit + +import ( + "io" + "log" + "os" +) + +var l log.Logger + +/* +1: default +2: error +3: critical error +*/ +func Log(shit string, lvl int, typeshi ...any) { + + switch lvl { + default: + l.Printf(shit, typeshi...) + case 2: + l.Printf("[err] "+shit, typeshi...) + case 3: + l.Panic(shit) + } +} + +func init() { + var fl *os.File + + _, err := os.Stat("logs") + if err != nil { + fl, err = os.Create("logs") + if err != nil { + panic("couldn't create log file") + } + } else { + fl, err = os.OpenFile("logs", os.O_APPEND, os.ModeAppend) + if err != nil { + panic("couldn't open log file, even tho it exists") + } + } + + mw := io.MultiWriter(os.Stdout, fl) + + l = *log.New(mw, "[nzx_tmpmail] ", log.LUTC|log.Ldate|log.Ltime) +} diff --git a/nzx_tmpmail/logs b/nzx_tmpmail/logs new file mode 100644 index 0000000..e69de29 diff --git a/nzx_tmpmail/main.go b/nzx_tmpmail/main.go new file mode 100644 index 0000000..7905807 --- /dev/null +++ b/nzx_tmpmail/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + +}