Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
二次元的罪恶王冠
beego
提交
f21cff01
B
beego
项目概览
二次元的罪恶王冠
/
beego
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beego
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f21cff01
编写于
3月 09, 2016
作者:
J
JessonChan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some typo fixed
上级
3dd90202
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
9 deletion
+9
-9
context/context.go
context/context.go
+1
-1
logs/multifile.go
logs/multifile.go
+7
-7
logs/multifile_test.go
logs/multifile_test.go
+1
-1
未找到文件。
context/context.go
浏览文件 @
f21cff01
...
...
@@ -212,7 +212,7 @@ func (w *Response) WriteHeader(code int) {
}
w
.
Status
=
code
w
.
Started
=
true
w
.
ResponseWriter
.
WriteHeader
(
w
.
Status
)
w
.
ResponseWriter
.
WriteHeader
(
code
)
}
// Hijack hijacker for http
...
...
logs/mul
it
file.go
→
logs/mul
ti
file.go
浏览文件 @
f21cff01
...
...
@@ -24,7 +24,7 @@ import (
// means if the file name in configuration is project.log filesLogWriter will create project.error.log/project.debug.log
// and write the error-level logs to project.error.log and write the debug-level logs to project.debug.log
// the rotate attribute also acts like fileLogWriter
type
mul
it
FileLogWriter
struct
{
type
mul
ti
FileLogWriter
struct
{
writers
[
LevelDebug
+
1
+
1
]
*
fileLogWriter
// the last one for fullLogWriter
fullLogWriter
*
fileLogWriter
Separate
[]
string
`json:"separate"`
...
...
@@ -45,7 +45,7 @@ var levelNames = [...]string{"emergency", "alert", "critical", "error", "warning
// "separate":["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"],
// }
func
(
f
*
mul
it
FileLogWriter
)
Init
(
config
string
)
error
{
func
(
f
*
mul
ti
FileLogWriter
)
Init
(
config
string
)
error
{
writer
:=
newFileWriter
()
.
(
*
fileLogWriter
)
err
:=
writer
.
Init
(
config
)
if
err
!=
nil
{
...
...
@@ -76,7 +76,7 @@ func (f *mulitFileLogWriter) Init(config string) error {
return
nil
}
func
(
f
*
mul
it
FileLogWriter
)
Destroy
()
{
func
(
f
*
mul
ti
FileLogWriter
)
Destroy
()
{
for
i
:=
0
;
i
<
len
(
f
.
writers
);
i
++
{
if
f
.
writers
[
i
]
!=
nil
{
f
.
writers
[
i
]
.
Destroy
()
...
...
@@ -84,7 +84,7 @@ func (f *mulitFileLogWriter) Destroy() {
}
}
func
(
f
*
mul
it
FileLogWriter
)
WriteMsg
(
when
time
.
Time
,
msg
string
,
level
int
)
error
{
func
(
f
*
mul
ti
FileLogWriter
)
WriteMsg
(
when
time
.
Time
,
msg
string
,
level
int
)
error
{
if
f
.
fullLogWriter
!=
nil
{
f
.
fullLogWriter
.
WriteMsg
(
when
,
msg
,
level
)
}
...
...
@@ -98,7 +98,7 @@ func (f *mulitFileLogWriter) WriteMsg(when time.Time, msg string, level int) err
return
nil
}
func
(
f
*
mul
it
FileLogWriter
)
Flush
()
{
func
(
f
*
mul
ti
FileLogWriter
)
Flush
()
{
for
i
:=
0
;
i
<
len
(
f
.
writers
);
i
++
{
if
f
.
writers
[
i
]
!=
nil
{
f
.
writers
[
i
]
.
Flush
()
...
...
@@ -108,9 +108,9 @@ func (f *mulitFileLogWriter) Flush() {
// newFilesWriter create a FileLogWriter returning as LoggerInterface.
func
newFilesWriter
()
Logger
{
return
&
mul
it
FileLogWriter
{}
return
&
mul
ti
FileLogWriter
{}
}
func
init
()
{
Register
(
"mul
it
file"
,
newFilesWriter
)
Register
(
"mul
ti
file"
,
newFilesWriter
)
}
logs/mul
it
file_test.go
→
logs/mul
ti
file_test.go
浏览文件 @
f21cff01
...
...
@@ -24,7 +24,7 @@ import (
func
TestFiles_1
(
t
*
testing
.
T
)
{
log
:=
NewLogger
(
10000
)
log
.
SetLogger
(
"mul
it
file"
,
`{"filename":"test.log","separate":["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]}`
)
log
.
SetLogger
(
"mul
ti
file"
,
`{"filename":"test.log","separate":["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]}`
)
log
.
Debug
(
"debug"
)
log
.
Informational
(
"info"
)
log
.
Notice
(
"notice"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录