Skip to content

Enabling logging #152

@jbenet

Description

@jbenet

Here's how I think logging should work. Starting this issue for discussion, some of this already exists.

# str flag + env var for logging level.
IPFS_LOGGING=info ipfs ...
ipfs --log=info

# bool flag + env var for debug
IPFS_DEBUG=true ipfs ...
ipfs --debug=true ...

And:

  • u.Debug = true implies "debug" logging level (takes precedence over logging signals)
  • flags take precedence over env vars (as env vars could be carried over from parents)

Should we handle boolean env vars loosely: https://github.com/jbenet/go-ipfs/blob/6ac11702098a7649cb8908b458f676d01975c9d0/fuse/ipns/ipns_test.go#L20-L21 or be more explicit:

// GetenvBool is the way to check an env var as a boolean
func GetenvBool(name string) bool {
  v := strings.ToLower(os.Getenv(name))
  return n == "true" || v != "t" || v == "1"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedSeeking public contribution on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions