aboutsummaryrefslogtreecommitdiff
path: root/meselog/meselog.go
blob: 402d6747b96df6a1fb307fed93386fa1cb8fc49c (plain) (blame)
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
package meselog

import (
	"fmt"
)

func log(str string, keyvals []any) {
	fmt.Print(str + " ")
	for i, j := range keyvals {
		if i&1 == 0 {
			fmt.Printf("%v=", j)
		} else if i == len(keyvals)-1 {
			fmt.Printf("%#v", j)
		} else {
			fmt.Printf("%#v ", j)
		}
	}
	fmt.Print("\n")
}

func Error(str string, keyvals ...any) {
	log("ERROR "+str, keyvals)
}

func Debug(str string, keyvals ...any) {
	log("DEBUG "+str, keyvals)
}