Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
54c2a14c
Commit
54c2a14c
authored
10 years ago
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nocolor log fmt
parent
ef6d7350
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
util/log.go
util/log.go
+3
-2
No files found.
util/log.go
View file @
54c2a14c
...
...
@@ -18,10 +18,11 @@ var ansiBlue = "\033[0;34m"
// LogFormats is a map of formats used for our logger, keyed by name.
var
LogFormats
=
map
[
string
]
string
{
"
default"
:
"%{
color
}
%{time:2006-01-02 15:04:05.000000} %{level} %{module} %{shortfile}:
%{color:reset}
%{message}"
,
"
no
color
"
:
"
%{time:2006-01-02 15:04:05.000000} %{level} %{module} %{shortfile}:
%{message}"
,
"color"
:
ansiGray
+
"%{time:15:04:05.000} %{color}%{level:5.5s} "
+
ansiBlue
+
"%{module:10.10s}: %{color:reset}%{message} "
+
ansiGray
+
"%{shortfile}%{color:reset}"
,
}
var
defaultLogFormat
=
"color"
// Logging environment variables
const
(
...
...
@@ -42,7 +43,7 @@ func SetupLogging() {
fmt
:=
LogFormats
[
os
.
Getenv
(
envLoggingFmt
)]
if
fmt
==
""
{
fmt
=
LogFormats
[
"
default
"
]
fmt
=
LogFormats
[
default
LogFormat
]
}
backend
:=
logging
.
NewLogBackend
(
os
.
Stderr
,
""
,
0
)
...
...
This diff is collapsed.
Click to expand it.
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