Skip to content

Improve logging#179

Merged
jbenet merged 12 commits intoipfs:masterfrom
cryptix:improveLogging
Oct 15, 2014
Merged

Improve logging#179
jbenet merged 12 commits intoipfs:masterfrom
cryptix:improveLogging

Conversation

@cryptix
Copy link
Copy Markdown
Contributor

@cryptix cryptix commented Oct 15, 2014

This implements parts of #152.
Mainly the IPFS_DEBUG flag and the ipfs log command to change log levels of a running daemon. I chose add a explicit GetEnvBool() to the util pkg.

@cryptix
Copy link
Copy Markdown
Contributor Author

cryptix commented Oct 15, 2014

Maybe we should add the different log levels to the help?

cmd/ipfs/ipfs.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a case where we do want fmt.Fprintf(os.Stderr, ..., because this should be output cleanly to the user in the cli (the logger has a complicated format, and may be redirected later on).

Think about this like git or other tools. normal errors part of the use of the application should usually result in the user getting a simple error message. The logger is to signal what's going on under the hood, a logger.Error is closer to an unexpected problem.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok makes sense

cmd/ipfs/log.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    UsageLine: "log <name> <level> ",
    Short:     "switch logging levels of a running daemon",
    Long: `ipfs log <name> <level> - switch logging levels of a running daemon 

   <name> is a the subsystem logging identifier. Use * for all subsystems.
   <level> is one of: debug, info, notice, warning, error, critical

ipfs log is a utility command used to change the logging output of a running daemon.

`

util/log.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a bug with how the logic was before (setting lvl := logging.ERROR, and changing it if the env var, etc) ? That way SetAllLoggers is only called once.

@jbenet
Copy link
Copy Markdown
Member

jbenet commented Oct 15, 2014

Ok, just a couple things to address, and this LGTM!

@cryptix
Copy link
Copy Markdown
Contributor Author

cryptix commented Oct 15, 2014

Addressed :]

@jbenet
Copy link
Copy Markdown
Member

jbenet commented Oct 15, 2014

Great!! Merging. Onwards. Thanks!

jbenet added a commit that referenced this pull request Oct 15, 2014
@jbenet jbenet merged commit f0571d3 into ipfs:master Oct 15, 2014
This was referenced Oct 15, 2014
@cryptix cryptix deleted the improveLogging branch October 15, 2014 12:45
@whyrusleeping
Copy link
Copy Markdown
Member

@jbenet where do you get all these gifs from? I image you have a TB hard drive full of gifs sorted in some specific way, and maybe a helper program you can type keywords into and have it spit back a gif. Ill bet that was the motivation for IPFS, you didnt have enough local hard drive space for your gifs, so you needed a clever way to trick other people into storing them for you... very smart 👍

@cryptix
Copy link
Copy Markdown
Contributor Author

cryptix commented Oct 15, 2014

:D That would make for an awesome example app when the alpha is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants