mirror of
https://github.com/tiennm99/gomoku.git
synced 2026-05-20 22:24:04 +00:00
1b9eec5f7d
- Module: github.com/ratel-online/server → github.com/tiennm99/gomoku/server
- Copied core/{log,util/async,util/json,util/strings,model,network,protocol,consts}
into server/pkg/* (temporary shims until phase-05 replaces protocol/network)
- Rewrote all ratel-online import paths across server/**/*.go
- Trimmed main.go: single -p flag, WS-only on :1999, no TCP/bot/static
- Trimmed network/wss.go: endpoint /gomoku, no static file serving
- Updated Makefile: removed TCP/bot references, port 1999
43 lines
899 B
Go
43 lines
899 B
Go
package log
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"runtime"
|
|
"time"
|
|
)
|
|
|
|
func sprintf(t string, format string, args ...interface{}) string {
|
|
_, path, line, _ := runtime.Caller(3)
|
|
_, file := filepath.Split(path)
|
|
return fmt.Sprintf(fmt.Sprintf("%s [%s] %s:%d %s", time.Now().Format("2006-01-02 15:04:05.999"), t, file, line, format), args...)
|
|
}
|
|
|
|
func printf(t string, format string, args ...interface{}) {
|
|
fmt.Printf(sprintf(t, format, args...))
|
|
}
|
|
|
|
func Infof(format string, args ...interface{}) {
|
|
printf("INFO", format, args...)
|
|
}
|
|
|
|
func Info(arg interface{}) {
|
|
printf("INFO", "%v\n", arg)
|
|
}
|
|
|
|
func Errorf(format string, args ...interface{}) {
|
|
printf("ERROR", format, args...)
|
|
}
|
|
|
|
func Error(arg interface{}) {
|
|
printf("ERROR", "%v\n", arg)
|
|
}
|
|
|
|
func Panicf(format string, args ...interface{}) {
|
|
panic(sprintf("PANIC", format, args...))
|
|
}
|
|
|
|
func Panic(arg interface{}) {
|
|
printf("PANIC", "%v\n", arg)
|
|
}
|