• A
    Miscellaneous logging improvements (#1525) · 48f1f51e
    Alessandro Arzilli 提交于
    * *: use loglevel to control what gets logged instead of output redirection
    
    This stops logrus from doing all the formatting just to discard it
    immediately afterwards.
    
    * logflags: replace default formatter of logrus
    
    The default formatter of logrus emits logs in two different formats
    depending on whether or not the output is going to a terminal. The
    output format for non-terminals is indented to be machine readable, but
    we mostly read logs ourselves and the excessive quoting makes that
    format unreadable.
    When outputting to terminals it uses ANSI escape codes unconditionally,
    without checking whether the terminal it is connected to actually
    supports colors.
    
    This commit replaces the default formatter with a much simpler
    formatter that always uses a more readable format, doesn't use colors
    and places the key-value pairs at the beginning of the line (which is a
    better match for how we use them).
    
    * cmd/dlv: add command line options to redirect logs
    
    Adds two options, --log-to-file and --log-to-fd, to redirect logs to a
    file or to a file descriptor.
    
    When one of those two options is specified the "API server listening
    at:" message will also be redirected to the specified file/file
    descriptor.
    This allows clients that want to use the "API server listening at:"
    message to do so even if they want to redirect the target's stdout to
    another file or device.
    
    Implements #1179, #1523
    48f1f51e
dlv.md 2.9 KB