-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
34 lines (27 loc) · 901 Bytes
/
logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"log"
"os"
)
var (
WarningLogger *log.Logger
InfoLogger *log.Logger
ErrorLogger *log.Logger
)
func init() {
// file, err := os.OpenFile("logs.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
// if err != nil {
// log.Fatal(err)
// }
InfoLogger = log.New(os.Stdout, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile)
WarningLogger = log.New(os.Stdout, "WARNING: ", log.Ldate|log.Ltime|log.Lshortfile)
ErrorLogger = log.New(os.Stdout, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile)
}
// func main() {
// InfoLogger.Println("Starting the application...")
// InfoLogger.Println("Something noteworthy happened")
// WarningLogger.Println("There is something you should know about")
// ErrorLogger.Println("Something went wrong")
// }
// https://www.honeybadger.io/blog/golang-logging/
// https://appdividend.com/2019/11/28/golang-log-example-log-package-in-go/