There are several instances in the codebase where a logger is required in order to make a function call, but messages sent to the logger by the function don't need to be exposed to the user. In these cases, agent/log's NewSilentMockLog function, which returns a mock implementation of log.T, is used:
Unfortunately this introduces a dependency on github.com/stretchr/testify/mock into the production binaries, which isn't ideal. IMO, it would be better to create a new seelog logger, similar to DefaultLogger, that simply discards anything that is sent to it by setting its minimum log level to off.
There are several instances in the codebase where a logger is required in order to make a function call, but messages sent to the logger by the function don't need to be exposed to the user. In these cases,
agent/log
'sNewSilentMockLog
function, which returns a mock implementation oflog.T
, is used:https://github.com/aws/amazon-ssm-agent/blob/db56c99f4966ce1e60290b613b87326db080cb85/agent/log/test_log.go#L51-L56
Unfortunately this introduces a dependency on
github.com/stretchr/testify/mock
into the production binaries, which isn't ideal. IMO, it would be better to create a new seelog logger, similar toDefaultLogger
, that simply discards anything that is sent to it by setting its minimum log level tooff
.