From 67bcbc08daffa9a3b87857005f8c853aa68af915 Mon Sep 17 00:00:00 2001 From: shaoying Date: Wed, 1 Apr 2020 17:59:54 +0800 Subject: [PATCH] add bench.go --- core/code/bench.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 core/code/bench.go diff --git a/core/code/bench.go b/core/code/bench.go new file mode 100644 index 00000000..519853b6 --- /dev/null +++ b/core/code/bench.go @@ -0,0 +1,48 @@ +package code + +import ( + "github.com/shylinux/icebergs" + "github.com/shylinux/toolkits" +) + +type Bench struct { + *ice.Message +} + +func (b *Bench) Get(key string) string { + return b.Conf("hi", key) +} +func (b *Bench) GetInt(key string) int64 { + return kit.Int64(b.Conf("hi", key)) +} + +func (b *Bench) Log(key string, arg ...interface{}) { + b.Message.Info("%s: %v", key, kit.Simple(key)) +} +func (b *Bench) Logf(key string, str string, arg ...interface{}) { + b.Message.Info("%s: %v", key, kit.Format(str, arg...)) +} +func (b *Bench) Info(arg ...interface{}) { + b.Log("info", arg...) +} +func (b *Bench) Infof(str string, arg ...interface{}) { + b.Logf("info", str, arg...) +} +func (b *Bench) Warn(arg ...interface{}) { + b.Log("warn", arg...) +} +func (b *Bench) Warnf(str string, arg ...interface{}) { + b.Logf("warn", str, arg...) +} +func (b *Bench) Error(arg ...interface{}) { + b.Log("error", arg...) +} +func (b *Bench) Errorf(str string, arg ...interface{}) { + b.Logf("error", str, arg...) +} +func (b *Bench) Debug(arg ...interface{}) { + b.Log("debug", arg...) +} +func (b *Bench) Debugf(str string, arg ...interface{}) { + b.Logf("debug", str, arg...) +}