-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Event Hubs] Map all logging to log levels #2845
Comments
Please revisit the latest guidelines around logging before starting making any code changes here |
SummaryThe Supported Log ChannelsProposalThe export const logError = debug("azure:event-hubs:error");
export const logWarning = debug("azure:event-hubs:warning");
export const logInfo = debug("azure:event-hubs:info");
export const logVerbose = debug("azure:event-hubs:verbose"); A user likely doesn't know or care about individual components of a library. Using only a service-level log channel keeps the number of channels we expose relatively small BackgroundThe event hubs sdk has existing log channels that are used by the SDK today: The guidelines specify the following with regards to naming and creating log channels:
Enabling Log LevelsProposalThe guidelines around enabling log levels are not yet finalized. Take the following log levels defined in the guidelines:
We might expect that if a user enables Using Log LevelsProposalErrorI'm not aware of any known scenarios in WarningMost places where we use We should use the
Also note that stack traces should be sent to the Example: async function foo(abortSignal?: AbortSignalLike): Promise<void> {
try {
return await bar(abortSignal);
} catch (err) {
if (err.name === 'AbortError') {
log.info(err.message);
} else if (err.retryable && canStillRetry) {
// assuming we will automatically retry this error...
log.verbose(err.message, err.stack);
} else {
log.warning(err.message);
log.verbose(err.stack);
}
throw err;
}
} InfoMany places where we currently use a feature log channel should use the This channel is meant to be used when a function operates normally. For example, the azure-sdk-for-js/sdk/eventhub/event-hubs/src/receiver.ts Lines 348 to 354 in 404347b
VerboseThe verbose channel is meant for logging information that's useful for troubleshooting. For example, the azure-sdk-for-js/sdk/eventhub/event-hubs/src/receiver.ts Lines 374 to 380 in 404347b
BackgroundThe SDK guidelines specify the following rules for determining which log level to write to:
|
Work has been started in #5401 but needs work due to some major refactoring that's occurred. |
In order to support the feature where we let users set loglevels, we need to re-visit all the logging we do. They need to be updated such that we know what combination of different log modules should be used in the enable() method of the debug package for each log level.
For more context on this, please see the plan outlined in #2662 (comment)
Log levels generally are
For example,
Verbose
would map to*
Info
would map toazure:event-hubs:*
Error
would map toazure:event-hubs:error
. This needs review as well, because today we uselog.error()
to log non errors as well.The text was updated successfully, but these errors were encountered: