Skip to content

Commit

Permalink
chore: integrate automaxprocs/maxprocs with zerolog
Browse files Browse the repository at this point in the history
Log messages from automaxprocs/maxprocs are now seamlessly integrated
into our existing logging framework.
Previously, automaxprocs/maxprocs relied solely on `printf` for
outputting messages directly to stdout. This approach bypassed any
user-defined log levels, leading to potential issues in log verbosity
and management.

Signed-off-by: Michael Adler <[email protected]>
  • Loading branch information
michaeladler authored and stormc committed Jan 16, 2024
1 parent a756aaa commit 26264a3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Fixed

### Changed

- Log messages from automaxprocs/maxprocs are now seamlessly integrated into existing logging framework

### Removed

## [0.2.0] - 2024-01-15

### Added

- Add optional `description` field to workflows
- Job event notifications via server-sent events (see #11)
- Plugin System for External Middlewares (see #43)
Expand All @@ -32,5 +44,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Initial release of wfx.

[unreleased]: https://github.com/siemens/wfx/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/siemens/wfx/releases/tag/v0.1.0
[0.2.0]: https://github.com/siemens/wfx/releases/tag/v0.2.0
[unreleased]: https://github.com/siemens/wfx/compare/v0.2.0...HEAD
4 changes: 4 additions & 0 deletions cmd/wfx/cmd/root/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/siemens/wfx/persistence"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"go.uber.org/automaxprocs/maxprocs"
)

var k = config.New()
Expand Down Expand Up @@ -101,6 +102,9 @@ Examples of tasks are installation of firmware or other types of commands issued
logFormat = k.String(logFormatFlag)
})
setupLogging(os.Stdout, logFormat, logLevel)
if _, err := maxprocs.Set(maxprocs.Logger(log.Printf)); err != nil {
log.Warn().Err(err).Msg("Failed to set GOMAXPROCS")
}

// start watching config
if fileProvider != nil {
Expand Down
1 change: 0 additions & 1 deletion cmd/wfx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package main

import (
"github.com/rs/zerolog/log"
_ "go.uber.org/automaxprocs"

"github.com/siemens/wfx/cmd/wfx/cmd/root"
"github.com/siemens/wfx/cmd/wfx/metadata"
Expand Down

0 comments on commit 26264a3

Please sign in to comment.