Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
65aad444
Commit
65aad444
authored
Jun 07, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(logging): added uname to context logger
parent
a02cf5be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
25 deletions
+2
-25
pkg/log/log.go
+0
-23
pkg/middleware/logger.go
+1
-1
pkg/middleware/middleware.go
+1
-1
No files found.
pkg/log/log.go
View file @
65aad444
...
...
@@ -158,29 +158,6 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) {
loggersToClose
=
append
(
loggersToClose
,
fileHandler
)
handler
=
fileHandler
// case "conn":
// LogConfigs[i] = util.DynMap{
// "level": level,
// "reconnectOnMsg": sec.Key("reconnect_on_msg").MustBool(),
// "reconnect": sec.Key("reconnect").MustBool(),
// "net": sec.Key("protocol").In("tcp", []string{"tcp", "unix", "udp"}),
// "addr": sec.Key("addr").MustString(":7020"),
// }
// case "smtp":
// LogConfigs[i] = util.DynMap{
// "level": level,
// "user": sec.Key("user").MustString("example@example.com"),
// "passwd": sec.Key("passwd").MustString("******"),
// "host": sec.Key("host").MustString("127.0.0.1:25"),
// "receivers": sec.Key("receivers").MustString("[]"),
// "subject": sec.Key("subject").MustString("Diagnostic message from serve"),
// }
// case "database":
// LogConfigs[i] = util.DynMap{
// "level": level,
// "driver": sec.Key("driver").String(),
// "conn": sec.Key("conn").String(),
// }
// case "syslog":
// LogConfigs[i] = util.DynMap{
// "level": level,
...
...
pkg/middleware/logger.go
View file @
65aad444
...
...
@@ -48,7 +48,7 @@ func Logger() macaron.Handler {
if
ctx
,
ok
:=
c
.
Data
[
"ctx"
];
ok
{
ctxTyped
:=
ctx
.
(
*
Context
)
ctxTyped
.
Logger
.
Info
(
"Request Completed"
,
"method"
,
req
.
Method
,
"path"
,
req
.
URL
.
Path
,
"status"
,
status
,
"remote_addr"
,
c
.
RemoteAddr
(),
"
uname"
,
ctxTyped
.
Login
,
"
time_ns"
,
timeTakenMs
,
"size"
,
rw
.
Size
())
ctxTyped
.
Logger
.
Info
(
"Request Completed"
,
"method"
,
req
.
Method
,
"path"
,
req
.
URL
.
Path
,
"status"
,
status
,
"remote_addr"
,
c
.
RemoteAddr
(),
"time_ns"
,
timeTakenMs
,
"size"
,
rw
.
Size
())
}
}
}
pkg/middleware/middleware.go
View file @
65aad444
...
...
@@ -50,7 +50,7 @@ func GetContextHandler() macaron.Handler {
initContextWithAnonymousUser
(
ctx
)
{
}
ctx
.
Logger
=
log
.
New
(
"context"
,
"user
"
,
ctx
.
UserId
,
"orgId"
,
ctx
.
OrgId
)
ctx
.
Logger
=
log
.
New
(
"context"
,
"user
Id"
,
ctx
.
UserId
,
"orgId"
,
ctx
.
OrgId
,
"uname"
,
ctx
.
Login
)
ctx
.
Data
[
"ctx"
]
=
ctx
c
.
Map
(
ctx
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment