blob: 1ef77b8041372fecbd19346f24c77815f0165f50 [file] [log] [blame]
Fumitoshi Ukai119dc912015-03-30 16:52:41 +09001package main
2
3import (
4 "bytes"
5 "fmt"
Shinichiro Hamaji0ec07702015-03-31 00:50:32 +09006 "os"
Fumitoshi Ukai119dc912015-03-30 16:52:41 +09007)
8
9func Log(f string, a ...interface{}) {
Shinichiro Hamaji07259e02015-04-02 03:14:41 +090010 if noKatiLogFlag {
11 return
12 }
13
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090014 var buf bytes.Buffer
15 buf.WriteString("*kati*: ")
16 buf.WriteString(f)
17 buf.WriteByte('\n')
18 fmt.Printf(buf.String(), a...)
19}
20
Shinichiro Hamaji7c4e3252015-03-30 23:04:25 +090021func Warn(filename string, lineno int, f string, a ...interface{}) {
22 f = fmt.Sprintf("%s:%d: warning: %s\n", filename, lineno, f)
23 fmt.Printf(f, a...)
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090024}
25
Shinichiro Hamaji0ec07702015-03-31 00:50:32 +090026func Error(filename string, lineno int, f string, a ...interface{}) {
27 f = fmt.Sprintf("%s:%d: %s\n", filename, lineno, f)
28 fmt.Printf(f, a...)
29 os.Exit(2)
Fumitoshi Ukai119dc912015-03-30 16:52:41 +090030}
Shinichiro Hamajib2fd38d2015-04-01 01:12:19 +090031
32func ErrorNoLocation(f string, a ...interface{}) {
33 f = fmt.Sprintf("%s\n", f)
34 fmt.Printf(f, a...)
35 os.Exit(2)
36}