8000 Fix logger by josedonizetti · Pull Request #3092 · aquasecurity/tracee · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix logger #3092

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

Merged
merged 3 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to 8000
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cmd/tracee/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ func initCmd() error {

// Server flags

// TODO: add webhook

rootCmd.Flags().Bool(
server.MetricsEndpointFlag,
false,
Expand Down
18 changes: 10 additions & 8 deletions pkg/cmd/cobra/cobra.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ import (
func GetTraceeRunner(c *cobra.Command, version string) (cmd.Runner, error) {
var runner cmd.Runner

// Log command line flags

// Logger initialization must be the first thing to be done,
// so all other packages can use it
logCfg, err := flags.PrepareLogger(viper.GetStringSlice("log"), true)
if err != nil {
return runner, err
}
logger.Init(logCfg)

// Rego command line flags

rego, err := flags.PrepareRego(viper.GetStringSlice("rego"))
Expand Down Expand Up @@ -67,14 +77,6 @@ func GetTraceeRunner(c *cobra.Command, version string) (cmd.Runner, error) {
}
cfg.Output = output.TraceeConfig

// Log command line flags

logCfg, err := flags.PrepareLogger(viper.GetStringSlice("log"), true)
if err != nil {
return runner, err
}
logger.Init(logCfg)

// OS release information

osInfo, err := helpers.GetOSInfo()
Expand Down
5 changes: 1 addition & 4 deletions pkg/cmd/tracee.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ func (r Runner) Run(ctx context.Context) error {
// Decide if HTTP server should be started

if r.Server != nil {
if r.Server.MetricsEndpointEnabled() {
r.TraceeConfig.MetricsEnabled = true
}

r.TraceeConfig.MetricsEnabled = r.Server.MetricsEndpointEnabled()
go r.Server.Start(ctx)
}

Expand Down
0