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
0631a394
Commit
0631a394
authored
10 years ago
by
Henry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up SetupLogging()
parent
afa5b7fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
15 deletions
+10
-15
cmd/ipfs/ipfs.go
cmd/ipfs/ipfs.go
+1
-4
util/log.go
util/log.go
+9
-11
No files found.
cmd/ipfs/ipfs.go
View file @
0631a394
...
...
@@ -86,10 +86,7 @@ func ipfsCmd(c *commander.Command, args []string) error {
}
func
main
()
{
u
.
Debug
=
false
// setup logging
// u.SetupLogging() done in an init() block now.
u
.
Debug
=
u
.
GetenvBool
(
"IPFS_DEBUG"
)
// if debugging, setup profiling.
if
u
.
Debug
{
...
...
This diff is collapsed.
Click to expand it.
util/log.go
View file @
0631a394
...
...
@@ -30,25 +30,23 @@ func SetupLogging() {
logging
.
SetBackend
(
backend
)
logging
.
SetFormatter
(
logging
.
MustStringFormatter
(
LogFormat
))
// always print critical and error?
SetAllLoggers
(
logging
.
CRITICAL
)
SetAllLoggers
(
logging
.
ERROR
)
lvl
:=
logging
.
ERROR
if
logenv
:=
os
.
Getenv
(
"IPFS_LOGGING"
);
logenv
!=
""
{
lvl
,
err
:=
logging
.
LogLevel
(
logenv
)
var
err
error
lvl
,
err
=
logging
.
LogLevel
(
logenv
)
if
err
!=
nil
{
log
.
Error
(
"logging.LogLevel() Error: %q
\n
"
,
err
)
}
else
{
SetAllLoggers
(
lvl
)
log
.
Error
(
"logging.LogLevel() Error: %q"
,
err
)
lvl
=
logging
.
ERROR
// reset to ERROR, could be undefined now(?)
}
}
if
GetenvBool
(
"IPFS_DEBUG"
)
{
log
.
Info
(
"enabling debug printing"
)
Debug
=
true
SetAllLoggers
(
logging
.
DEBUG
)
if
Debug
{
lvl
=
logging
.
DEBUG
}
SetAllLoggers
(
lvl
)
}
// SetAllLoggers changes the logging.Level of all loggers to lvl
...
...
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