-
Notifications
You must be signed in to change notification settings - Fork 113
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
RSDK-2725 Support debug logging for modules #2373
RSDK-2725 Support debug logging for modules #2373
Conversation
|
||
// NewInfoObservedTestLogger is a copy of NewObservedTestLogger with info level | ||
// debugging instead of debug level. | ||
func NewInfoObservedTestLogger(tb testing.TB) (golog.Logger, *observer.ObservedLogs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erd I can move this to golog
, but I wasn't sure how useful it was/whether it was even necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I suggested simplifying the new log constructor to never fail, which should simplify its use as well. My main concern is the new Debug option in the config struct doesn't have the proto/conversion code to actually be passed through from the cloud. Other notes inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor things in what's here, noted inline, but you still need to update config/proto_conversions.go (and related tests) for the new field in module config, which will mean you also need to bump the version of API in go.mod to include your recent updates there.
50a542b
to
b657c05
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice work... now you understand how much of a pain even simple API changes can be. :-)
Now you get to follow up with the App side of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
RSDK-2725
Adds
LogLevel
toconfig.Module
. Adds logic to pass alog-level
commandline argument to the module executable ifLogLevel
is set on the module orLogLevel
is unset on the module but module manager log level isDebug
. Adds helpermodule.NewLoggerFromArgs
to help create a debug or non-debug module based on whether--log-level=debug
is the third argument inos.Args
. Updates complexmodule example to have"log_level": "debug"
and usemodule.NewLoggerFromArgs
.Adds
NewInfoObserverTestLogger
test utility to make an observed test logger atInfo
level (instead of the defaultDebug
). Adds test to ensurelog_level
is passed correctly to module. Adds test to ensure module can start withoutLogLevel
and be reconfigured to have it. Modifies testmodule to usemodule.NewLoggerFromArgs
and log a debug message: "debug mode enabled".