-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user-configurable level logger #290
Comments
Alternative mode of operation:
|
My preference is github.com/sirupsen/logrus, which we use in our private repo already. Though, any logging should use an interface instead with a private implementation that wraps the real logging framework, so it's easy to swap. I'll send a private reference to this over Slack. |
I did not recommend logrus, because it is in maintenance mode:
One of the benefits of zap is that it avoids the reflection interface. With regard to creating an interface in front of it, that is fine. However, I am not sure that is worth the effort. In my experience, it is more important to understand how the framework can be configured/plugged to send the log messages to different places. |
There's almost zero effort to wrap the logging framework and a lot of effort to replace a logging framework if such a wrap doesn't exist. I'm fine going with zap. |
Created a document to collect requirements from the various issues and centralize some of the research. |
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Moving the gazelle logging util methods to a common util for all of the cli (cli/core/pkg/logger/logger.go). For now this util is the basic go `log` package, if we continue using this util for logging then we can replace the underlying log library with anything in the future. For now there are 2 undocumented env vars to configure logging level + output file. The log file + level is auto configured when used within `bazel test` which has been used by the gazelle tests for quite some time. Ref: #428 #480 #290 #26 GitOrigin-RevId: dd5b7949117ec4298671945d7d0df1ba288b9d8b
Add a level logger to the CLI. (I believe that I used zap in a previous life.) When problems happen in the field, we can ask them to enable logging and ship us the resulting log file. I would add two flags:
--log_level
and--log_output
. The log level would default to error. The log output would default to none. Other options for log output would be stderr and a file path.The text was updated successfully, but these errors were encountered: