You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I first thought that it would be useful to allow the acceptance tests to have a custom context. But after digging further on why didn't a sdk.Logger(ctx).Info() call log anything, I found out that the used zerolog instance is the disabled one.
Specifically, this:
funcinitStandaloneModeLogger() error {
// adjust field names to have parity with hclog, go-plugin uses hclog to// parse log messageszerolog.LevelFieldName="@level"zerolog.CallerFieldName="@caller"zerolog.TimestampFieldName="@timestamp"zerolog.MessageFieldName="@message"logger:=zerolog.New(os.Stderr)
// here the default context logger is set, but initStandaloneModeLogger is only called on sdk.serve, not when I'm developing connectorszerolog.DefaultContextLogger=&loggerreturnnil
}
It might be confusing for future connector developers to not see any logs when calling sdk.Logger(ctx).Info(), as it was confusing for me.
Solutions to this problem that I can think of:
make initStandaloneModeLogger public, and allow sdk consumers to initialize the logger
add an init call in logger.go that sets up zerolog.DefaultContextLogger
add an additional InitLogger function that does the same as initStandaloneModeLogger, but meant for testing purposes.
I have to add also that this is not that important for me anymore, as I know now why I did not see logs on my tests. I can just set the DefaultContextLogger myself on my test code.
The text was updated successfully, but these errors were encountered:
Feature description
I first thought that it would be useful to allow the acceptance tests to have a custom context. But after digging further on why didn't a
sdk.Logger(ctx).Info()
call log anything, I found out that the used zerolog instance is the disabled one.Specifically, this:
It might be confusing for future connector developers to not see any logs when calling
sdk.Logger(ctx).Info()
, as it was confusing for me.Solutions to this problem that I can think of:
logger.go
that sets upzerolog.DefaultContextLogger
InitLogger
function that does the same as initStandaloneModeLogger, but meant for testing purposes.I have to add also that this is not that important for me anymore, as I know now why I did not see logs on my tests. I can just set the DefaultContextLogger myself on my test code.
The text was updated successfully, but these errors were encountered: