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

[ASCII-949] Migrate log component to new file hierarchy #21178

Merged
merged 9 commits into from
Dec 8, 2023
4 changes: 2 additions & 2 deletions cmd/agent/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
)

const (
Expand Down Expand Up @@ -47,7 +47,7 @@ type SubcommandFactory func(globalParams *GlobalParams) []*cobra.Command
func GetDefaultCoreBundleParams(globalParams *GlobalParams) core.BundleParams {
return core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
LogParams: log.ForOneShot(LoggerName, "off", true)}
LogParams: logimpl.ForOneShot(LoggerName, "off", true)}
}

// MakeCommand makes the top-level Cobra command for this app.
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/subcommands/configcheck/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/DataDog/datadog-agent/cmd/agent/command"
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/pkg/flare"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
Expand Down Expand Up @@ -47,7 +47,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForOneShot("CORE", "off", true)}),
LogParams: logimpl.ForOneShot("CORE", "off", true)}),
core.Bundle,
)
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/diagnose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/pkg/api/util"
pkgconfig "github.com/DataDog/datadog-agent/pkg/config"
pkgdiagnose "github.com/DataDog/datadog-agent/pkg/diagnose"
Expand Down Expand Up @@ -78,7 +79,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(cliParams),
fx.Supply(core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
LogParams: log.ForOneShot("CORE", "off", true)}),
LogParams: logimpl.ForOneShot("CORE", "off", true)}),
core.Bundle,
diagnosesendermanagerimpl.Module,
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/agent/subcommands/dogstatsd/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/DataDog/datadog-agent/cmd/agent/command"
"github.com/DataDog/datadog-agent/comp/core"
cconfig "github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/pkg/aggregator"
"github.com/DataDog/datadog-agent/pkg/api/util"
pkgconfig "github.com/DataDog/datadog-agent/pkg/config"
Expand Down Expand Up @@ -52,7 +52,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(&topFlags),
fx.Supply(core.BundleParams{
ConfigParams: cconfig.NewAgentParams(globalParams.ConfFilePath),
LogParams: log.ForOneShot(command.LoggerName, "off", true)}),
LogParams: logimpl.ForOneShot(command.LoggerName, "off", true)}),
core.Bundle,
)
},
Expand All @@ -70,7 +70,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
return fxutil.OneShot(dumpContexts,
fx.Supply(core.BundleParams{
ConfigParams: cconfig.NewAgentParams(globalParams.ConfFilePath),
LogParams: log.ForOneShot(command.LoggerName, "off", true)}),
LogParams: logimpl.ForOneShot(command.LoggerName, "off", true)}),

core.Bundle,
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/flare/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/flare"
"github.com/DataDog/datadog-agent/comp/core/flare/helpers"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
Expand Down Expand Up @@ -85,7 +86,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
ConfigParams: config,
SecretParams: secrets.NewEnabledParams(),
SysprobeConfigParams: sysprobeconfigimpl.NewParams(sysprobeconfigimpl.WithSysProbeConfFilePath(globalParams.SysProbeConfFilePath)),
LogParams: log.ForOneShot(command.LoggerName, "off", false),
LogParams: logimpl.ForOneShot(command.LoggerName, "off", false),
}),
fx.Supply(flare.NewLocalParams(
commonpath.GetDistPath(),
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/hostname/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/pkg/util/fxutil"
"github.com/DataDog/datadog-agent/pkg/util/hostname"
)
Expand All @@ -40,7 +41,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(cliParams),
fx.Supply(core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
LogParams: log.ForOneShot(command.LoggerName, "off", false)}), // never output anything but hostname
LogParams: logimpl.ForOneShot(command.LoggerName, "off", false)}), // never output anything but hostname
core.Bundle,
)
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/subcommands/jmx/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/DataDog/datadog-agent/comp/api/api/apiimpl"
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors"
Expand Down Expand Up @@ -95,7 +95,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
params := core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForOneShot(command.LoggerName, cliParams.jmxLogLevel, false)}
LogParams: logimpl.ForOneShot(command.LoggerName, cliParams.jmxLogLevel, false)}
if cliParams.logFile != "" {
params.LogParams.LogToFile(cliParams.logFile)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/flare"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
Expand Down Expand Up @@ -162,7 +163,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
SysprobeConfigParams: sysprobeconfigimpl.NewParams(sysprobeconfigimpl.WithSysProbeConfFilePath(globalParams.SysProbeConfFilePath)),
LogParams: log.ForDaemon(command.LoggerName, "log_file", path.DefaultLogFile),
LogParams: logimpl.ForDaemon(command.LoggerName, "log_file", path.DefaultLogFile),
}),
getSharedFxOption(),
getPlatformModules(),
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/run/command_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/flare"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
Expand Down Expand Up @@ -148,7 +149,7 @@ func StartAgentWithDefaults(ctxChan <-chan context.Context) (<-chan error, error
ConfigParams: config.NewAgentParams(""),
SecretParams: secrets.NewEnabledParams(),
SysprobeConfigParams: sysprobeconfigimpl.NewParams(),
LogParams: log.ForDaemon(command.LoggerName, "log_file", path.DefaultLogFile),
LogParams: logimpl.ForDaemon(command.LoggerName, "log_file", path.DefaultLogFile),
}),
getSharedFxOption(),
getPlatformModules(),
Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/subcommands/snmp/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/DataDog/datadog-agent/cmd/agent/command"
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
utilFunc "github.com/DataDog/datadog-agent/pkg/snmp/gosnmplib"
parse "github.com/DataDog/datadog-agent/pkg/snmp/snmpparse"
Expand Down Expand Up @@ -99,7 +99,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForOneShot(command.LoggerName, "off", true)}),
LogParams: logimpl.ForOneShot(command.LoggerName, "off", true)}),
core.Bundle,
)
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/agent/subcommands/status/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
"github.com/DataDog/datadog-agent/pkg/api/util"
Expand Down Expand Up @@ -67,7 +68,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewAgentParams(globalParams.ConfFilePath),
SysprobeConfigParams: sysprobeconfigimpl.NewParams(sysprobeconfigimpl.WithSysProbeConfFilePath(globalParams.SysProbeConfFilePath)),
LogParams: log.ForOneShot(command.LoggerName, "off", true)}),
LogParams: logimpl.ForOneShot(command.LoggerName, "off", true)}),
core.Bundle,
)
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/cluster-agent-cloudfoundry/subcommands/run/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors"
Expand Down Expand Up @@ -63,7 +64,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewClusterAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForDaemon(command.LoggerName, "log_file", path.DefaultDCALogFile),
LogParams: logimpl.ForDaemon(command.LoggerName, "log_file", path.DefaultDCALogFile),
}),
core.Bundle,
forwarder.Bundle,
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster-agent/subcommands/compliance/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/DataDog/datadog-agent/cmd/security-agent/subcommands/check"
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
)

// Commands returns a slice of subcommands for the 'cluster-agent' command.
Expand All @@ -29,7 +29,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {

bundleParams := core.BundleParams{
ConfigParams: config.NewClusterAgentParams(""),
LogParams: log.ForOneShot(command.LoggerName, command.DefaultLogLevel, true),
LogParams: logimpl.ForOneShot(command.LoggerName, command.DefaultLogLevel, true),
}

complianceCmd.AddCommand(check.ClusterAgentCommands(bundleParams)...)
Expand Down
4 changes: 2 additions & 2 deletions cmd/cluster-agent/subcommands/diagnose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/DataDog/datadog-agent/comp/aggregator/diagnosesendermanager/diagnosesendermanagerimpl"
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/pkg/diagnose"
"github.com/DataDog/datadog-agent/pkg/diagnose/diagnosis"
Expand All @@ -36,7 +36,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewClusterAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForOneShot(command.LoggerName, "off", true), // no need to show regular logs
LogParams: logimpl.ForOneShot(command.LoggerName, "off", true), // no need to show regular logs
}),
core.Bundle,
diagnosesendermanagerimpl.Module,
Expand Down
3 changes: 2 additions & 1 deletion cmd/cluster-agent/subcommands/metamap/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/pkg/api/util"
pkgconfig "github.com/DataDog/datadog-agent/pkg/config"
Expand Down Expand Up @@ -47,7 +48,7 @@ as well as which services are serving the pods. Or the deployment name for the p
fx.Supply(core.BundleParams{
ConfigParams: config.NewClusterAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForOneShot(command.LoggerName, command.DefaultLogLevel, true),
LogParams: logimpl.ForOneShot(command.LoggerName, command.DefaultLogLevel, true),
}),
core.Bundle,
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/cluster-agent/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/telemetry"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
Expand Down Expand Up @@ -84,7 +85,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewClusterAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForDaemon(command.LoggerName, "log_file", path.DefaultDCALogFile),
LogParams: logimpl.ForDaemon(command.LoggerName, "log_file", path.DefaultDCALogFile),
}),
core.Bundle,
forwarder.Bundle,
Expand Down
3 changes: 2 additions & 1 deletion cmd/cluster-agent/subcommands/status/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/pkg/api/util"
pkgconfig "github.com/DataDog/datadog-agent/pkg/config"
Expand All @@ -47,7 +48,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {
fx.Supply(core.BundleParams{
ConfigParams: config.NewClusterAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
LogParams: log.ForOneShot(command.LoggerName, command.DefaultLogLevel, true),
LogParams: logimpl.ForOneShot(command.LoggerName, command.DefaultLogLevel, true),
}),
core.Bundle,
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/dogstatsd/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import (
"github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"

//nolint:revive // TODO(AML) Fix revive linter
logComponent "github.com/DataDog/datadog-agent/comp/core/log"
logComponent "github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/secrets/secretsimpl"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
Expand Down
3 changes: 2 additions & 1 deletion cmd/otel-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
corelog "github.com/DataDog/datadog-agent/comp/core/log"
corelogimpl "github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/forwarder"
"github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder"
Expand Down Expand Up @@ -68,7 +69,7 @@ func main() {
core.BundleParams{
ConfigParams: config.NewAgentParams(*cfgPath),
SecretParams: secrets.NewEnabledParams(),
LogParams: corelog.ForOneShot(loggerName, "debug", true),
LogParams: corelogimpl.ForOneShot(loggerName, "debug", true),
},
),
fx.Provide(newForwarderParams),
Expand Down
7 changes: 4 additions & 3 deletions cmd/process-agent/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
configComponent "github.com/DataDog/datadog-agent/comp/core/config"
logComponent "github.com/DataDog/datadog-agent/comp/core/log"
logComponentimpl "github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/secrets"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig/sysprobeconfigimpl"
"github.com/DataDog/datadog-agent/pkg/config"
Expand All @@ -26,10 +27,10 @@ import (
const LoggerName config.LoggerName = "PROCESS"

// DaemonLogParams are the log params should be given to the `core.BundleParams` for when the process agent is running as a daemon
var DaemonLogParams = logComponent.ForDaemon(string(LoggerName), "process_config.log_file", config.DefaultProcessAgentLogFile)
var DaemonLogParams = logComponentimpl.ForDaemon(string(LoggerName), "process_config.log_file", config.DefaultProcessAgentLogFile)

// OneShotLogParams are the log params that are given to commands
var OneShotLogParams = logComponent.ForOneShot(string(LoggerName), "info", true)
var OneShotLogParams = logComponentimpl.ForOneShot(string(LoggerName), "info", true)

// GlobalParams contains the values of agent-global Cobra flags.
//
Expand Down Expand Up @@ -148,6 +149,6 @@ func GetCoreBundleParamsForOneShot(globalParams *GlobalParams) core.BundleParams
ConfigParams: configComponent.NewAgentParams(globalParams.ConfFilePath),
SecretParams: secrets.NewEnabledParams(),
SysprobeConfigParams: sysprobeconfigimpl.NewParams(sysprobeconfigimpl.WithSysProbeConfFilePath(globalParams.SysProbeConfFilePath)),
LogParams: logComponent.ForOneShot(string(LoggerName), "info", true),
LogParams: logComponentimpl.ForOneShot(string(LoggerName), "info", true),
}
}
3 changes: 2 additions & 1 deletion cmd/process-agent/subcommands/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/DataDog/datadog-agent/comp/core"
"github.com/DataDog/datadog-agent/comp/core/config"
"github.com/DataDog/datadog-agent/comp/core/log"
"github.com/DataDog/datadog-agent/comp/core/log/logimpl"
"github.com/DataDog/datadog-agent/comp/core/sysprobeconfig"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta"
"github.com/DataDog/datadog-agent/comp/core/workloadmeta/collectors"
Expand Down Expand Up @@ -87,7 +88,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command {

// Disable logging if `--json` is specified. This way the check command will output proper json.
if cliParams.checkOutputJSON {
bundleParams.LogParams = log.ForOneShot(string(command.LoggerName), "off", true)
bundleParams.LogParams = logimpl.ForOneShot(string(command.LoggerName), "off", true)
}

return fxutil.OneShot(runCheckCmd,
Expand Down
Loading
Loading