Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FinClip
ligase
提交
80100830
ligase
项目概览
FinClip
/
ligase
通知
37
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ligase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
80100830
编写于
4月 20, 2017
作者:
R
Robert Swain
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dendrite/common: Move logrus configuration to common
上级
db428174
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
29 addition
and
36 deletion
+29
-36
src/github.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go
...ub.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go
+2
-18
src/github.com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go
....com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go
+2
-18
src/github.com/matrix-org/dendrite/common/log.go
src/github.com/matrix-org/dendrite/common/log.go
+25
-0
未找到文件。
src/github.com/matrix-org/dendrite/cmd/dendrite-clientapi/main.go
浏览文件 @
80100830
...
...
@@ -3,34 +3,18 @@ package main
import
(
"net/http"
"os"
"path/filepath"
"golang.org/x/crypto/ed25519"
"github.com/matrix-org/dendrite/clientapi/config"
"github.com/matrix-org/dendrite/clientapi/producers"
"github.com/matrix-org/dendrite/clientapi/routing"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/roomserver/api"
log
"github.com/Sirupsen/logrus"
"github.com/matrix-org/dugong"
)
func
setupLogging
(
logDir
string
)
{
_
=
os
.
Mkdir
(
logDir
,
os
.
ModePerm
)
log
.
AddHook
(
dugong
.
NewFSHook
(
filepath
.
Join
(
logDir
,
"info.log"
),
filepath
.
Join
(
logDir
,
"warn.log"
),
filepath
.
Join
(
logDir
,
"error.log"
),
&
log
.
TextFormatter
{
TimestampFormat
:
"2006-01-02 15:04:05.000000"
,
DisableColors
:
true
,
DisableTimestamp
:
false
,
DisableSorting
:
false
,
},
&
dugong
.
DailyRotationSchedule
{
GZip
:
true
},
))
}
func
main
()
{
bindAddr
:=
os
.
Getenv
(
"BIND_ADDRESS"
)
if
bindAddr
==
""
{
...
...
@@ -38,7 +22,7 @@ func main() {
}
logDir
:=
os
.
Getenv
(
"LOG_DIR"
)
if
logDir
!=
""
{
s
etupLogging
(
logDir
)
common
.
S
etupLogging
(
logDir
)
}
// TODO: Rather than generating a new key on every startup, we should be
...
...
src/github.com/matrix-org/dendrite/cmd/dendrite-sync-server/main.go
浏览文件 @
80100830
...
...
@@ -5,8 +5,8 @@ import (
"io/ioutil"
"net/http"
"os"
"path/filepath"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/syncserver/config"
"github.com/matrix-org/dendrite/syncserver/consumers"
"github.com/matrix-org/dendrite/syncserver/routing"
...
...
@@ -14,28 +14,12 @@ import (
"github.com/matrix-org/dendrite/syncserver/sync"
log
"github.com/Sirupsen/logrus"
"github.com/matrix-org/dugong"
yaml
"gopkg.in/yaml.v2"
)
var
configPath
=
flag
.
String
(
"config"
,
"sync-server-config.yaml"
,
"The path to the config file. For more information, see the config file in this repository."
)
var
bindAddr
=
flag
.
String
(
"listen"
,
":4200"
,
"The port to listen on."
)
func
setupLogging
(
logDir
string
)
{
_
=
os
.
Mkdir
(
logDir
,
os
.
ModePerm
)
log
.
AddHook
(
dugong
.
NewFSHook
(
filepath
.
Join
(
logDir
,
"info.log"
),
filepath
.
Join
(
logDir
,
"warn.log"
),
filepath
.
Join
(
logDir
,
"error.log"
),
&
log
.
TextFormatter
{
TimestampFormat
:
"2006-01-02 15:04:05.000000"
,
DisableColors
:
true
,
DisableTimestamp
:
false
,
DisableSorting
:
false
,
},
&
dugong
.
DailyRotationSchedule
{
GZip
:
true
},
))
}
func
loadConfig
(
configPath
string
)
(
*
config
.
Sync
,
error
)
{
contents
,
err
:=
ioutil
.
ReadFile
(
configPath
)
if
err
!=
nil
{
...
...
@@ -65,7 +49,7 @@ func main() {
}
logDir
:=
os
.
Getenv
(
"LOG_DIR"
)
if
logDir
!=
""
{
s
etupLogging
(
logDir
)
common
.
S
etupLogging
(
logDir
)
}
log
.
Info
(
"sync server config: "
,
cfg
)
...
...
src/github.com/matrix-org/dendrite/common/log.go
0 → 100644
浏览文件 @
80100830
package
common
import
(
"os"
"path/filepath"
"github.com/Sirupsen/logrus"
"github.com/matrix-org/dugong"
)
// SetupLogging configures the logging format and destination(s).
func
SetupLogging
(
logDir
string
)
{
_
=
os
.
Mkdir
(
logDir
,
os
.
ModePerm
)
logrus
.
AddHook
(
dugong
.
NewFSHook
(
filepath
.
Join
(
logDir
,
"info.log"
),
filepath
.
Join
(
logDir
,
"warn.log"
),
filepath
.
Join
(
logDir
,
"error.log"
),
&
logrus
.
TextFormatter
{
TimestampFormat
:
"2006-01-02 15:04:05.000000"
,
DisableColors
:
true
,
DisableTimestamp
:
false
,
DisableSorting
:
false
,
},
&
dugong
.
DailyRotationSchedule
{
GZip
:
true
},
))
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录