Skip to content
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

Open
cgrindel opened this issue Oct 4, 2022 · 7 comments
Open

Add user-configurable level logger #290

cgrindel opened this issue Oct 4, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@cgrindel
Copy link
Contributor

cgrindel commented Oct 4, 2022

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.

@cgrindel cgrindel added enhancement New feature or request prioritized labels Oct 4, 2022
@cgrindel cgrindel added this to the CLI MVP - Release 1.0.0 milestone Oct 4, 2022
@cgrindel
Copy link
Contributor Author

cgrindel commented Oct 4, 2022

Alternative mode of operation:

  • Always log; would need to add log rotation logic.

@cgrindel
Copy link
Contributor Author

cgrindel commented Oct 5, 2022

@f0rmiga I am suggesting that we leverage zap as the logging framework. Do you have any thoughts on other logging frameworks that we should consider?

@f0rmiga
Copy link
Contributor

f0rmiga commented Oct 5, 2022

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.

@cgrindel
Copy link
Contributor Author

cgrindel commented Oct 5, 2022

I did not recommend logrus, because it is in maintenance mode:

Logrus 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.

@f0rmiga
Copy link
Contributor

f0rmiga commented Oct 5, 2022

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.

@cgrindel
Copy link
Contributor Author

cgrindel commented Oct 5, 2022

Related to #26, #81, #94

@cgrindel
Copy link
Contributor Author

cgrindel commented Oct 6, 2022

Created a document to collect requirements from the various issues and centralize some of the research.

@alexeagle alexeagle removed this from the CLI MVP - Release 1.0.0 milestone Nov 10, 2022
@gregmagolan gregmagolan removed their assignment Feb 5, 2023
gregmagolan pushed a commit that referenced this issue Sep 22, 2023
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
jbedard added a commit that referenced this issue Oct 4, 2023
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
jbedard added a commit that referenced this issue Oct 4, 2023
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
jbedard added a commit that referenced this issue Oct 4, 2023
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
jbedard added a commit that referenced this issue Oct 7, 2023
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
jbedard added a commit that referenced this issue Oct 7, 2023
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
jbedard added a commit that referenced this issue Oct 7, 2023
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
jbedard added a commit that referenced this issue Oct 9, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

4 participants