forked from x/icebergs
add some
This commit is contained in:
parent
9568a8c215
commit
deddfc9457
13
base/log/bench.go
Normal file
13
base/log/bench.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package log
|
||||||
|
|
||||||
|
import (
|
||||||
|
ice "shylinux.com/x/icebergs"
|
||||||
|
)
|
||||||
|
|
||||||
|
const BENCH = "bench"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
Index.MergeCommands(ice.Commands{
|
||||||
|
BENCH: {Help: "记录", Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
|
})
|
||||||
|
}
|
@ -29,6 +29,9 @@ func (f *Frame) Begin(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
func (f *Frame) Start(m *ice.Message, arg ...string) {
|
func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||||
mdb.Confm(m, FILE, nil, func(k string, v ice.Map) {
|
mdb.Confm(m, FILE, nil, func(k string, v ice.Map) {
|
||||||
|
if mdb.Conf(m, k, kit.Keym(mdb.DISABLE)) == ice.TRUE {
|
||||||
|
return
|
||||||
|
}
|
||||||
if f, p, e := logs.CreateFile(kit.Format(v[nfs.PATH])); e == nil {
|
if f, p, e := logs.CreateFile(kit.Format(v[nfs.PATH])); e == nil {
|
||||||
m.Logs(nfs.SAVE, nfs.FILE, p)
|
m.Logs(nfs.SAVE, nfs.FILE, p)
|
||||||
v[FILE] = bufio.NewWriter(f)
|
v[FILE] = bufio.NewWriter(f)
|
||||||
@ -72,9 +75,6 @@ const (
|
|||||||
YELLOW = "yellow"
|
YELLOW = "yellow"
|
||||||
RED = "red"
|
RED = "red"
|
||||||
)
|
)
|
||||||
const (
|
|
||||||
BENCH = "bench"
|
|
||||||
)
|
|
||||||
const (
|
const (
|
||||||
FILE = "file"
|
FILE = "file"
|
||||||
VIEW = "view"
|
VIEW = "view"
|
||||||
@ -103,7 +103,7 @@ var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{
|
|||||||
SHOW: {Name: SHOW, Help: "日志分流", Value: kit.Dict()},
|
SHOW: {Name: SHOW, Help: "日志分流", Value: kit.Dict()},
|
||||||
}, Commands: ice.Commands{
|
}, Commands: ice.Commands{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ice.Info.Load(m, TAIL)
|
ice.Info.Load(m)
|
||||||
mdb.Confm(m, FILE, nil, func(key string, value ice.Map) {
|
mdb.Confm(m, FILE, nil, func(key string, value ice.Map) {
|
||||||
kit.For(value[mdb.LIST], func(index int, k string) { m.Conf(SHOW, kit.Keys(k, FILE), key) })
|
kit.For(value[mdb.LIST], func(index int, k string) { m.Conf(SHOW, kit.Keys(k, FILE), key) })
|
||||||
})
|
})
|
||||||
@ -111,7 +111,9 @@ var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{
|
|||||||
kit.For(value[mdb.LIST], func(index int, k string) { m.Conf(SHOW, kit.Keys(k, VIEW), key) })
|
kit.For(value[mdb.LIST], func(index int, k string) { m.Conf(SHOW, kit.Keys(k, VIEW), key) })
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { ice.Info.Save(m, TAIL) }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
ice.Info.Save(m)
|
||||||
|
}},
|
||||||
}}
|
}}
|
||||||
|
|
||||||
func init() { ice.Index.Register(Index, &Frame{}, TAIL) }
|
func init() { ice.Index.Register(Index, &Frame{}, TAIL) }
|
||||||
|
@ -143,14 +143,15 @@ func init() {
|
|||||||
m.Option(nfs.FILE, path.Join(m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), GO)))
|
m.Option(nfs.FILE, path.Join(m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), GO)))
|
||||||
m.Option(mdb.TEXT, kit.Format("`name:\"list %s\" help:\"%s\"`", _autogen_list(m), m.Option(mdb.HELP)))
|
m.Option(mdb.TEXT, kit.Format("`name:\"list %s\" help:\"%s\"`", _autogen_list(m), m.Option(mdb.HELP)))
|
||||||
defer m.Go(func() { _autogen_version(m.Spawn()) })
|
defer m.Go(func() { _autogen_version(m.Spawn()) })
|
||||||
if p := path.Join(ice.SRC, kit.ExtChange(m.Option(nfs.FILE), SHY)); !nfs.Exists(m, p) {
|
|
||||||
_autogen_source(m, kit.ExtChange(path.Join(ice.SRC, m.Option(cli.MAIN)), SHY), p)
|
|
||||||
_autogen_script(m, p)
|
|
||||||
}
|
|
||||||
if p := path.Join(ice.SRC, m.Option(nfs.FILE)); !nfs.Exists(m, p) {
|
if p := path.Join(ice.SRC, m.Option(nfs.FILE)); !nfs.Exists(m, p) {
|
||||||
_autogen_import(m, path.Join(ice.SRC, m.Option(cli.MAIN)), m.Option(mdb.ZONE), _autogen_mod(m, ice.GO_MOD))
|
_autogen_import(m, path.Join(ice.SRC, m.Option(cli.MAIN)), m.Option(mdb.ZONE), _autogen_mod(m, ice.GO_MOD))
|
||||||
_autogen_module(m, p)
|
_autogen_module(m, p)
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
if p := path.Join(ice.SRC, kit.ExtChange(m.Option(nfs.FILE), SHY)); !nfs.Exists(m, p) {
|
||||||
|
_autogen_source(m, kit.ExtChange(path.Join(ice.SRC, m.Option(cli.MAIN)), SHY), p)
|
||||||
|
_autogen_script(m, p)
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
DEVPACK: {Help: "开发", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(WEBPACK, mdb.REMOVE) }},
|
DEVPACK: {Help: "开发", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(WEBPACK, mdb.REMOVE) }},
|
||||||
WEBPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(WEBPACK, mdb.CREATE) }},
|
WEBPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(WEBPACK, mdb.CREATE) }},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user