Skip to content

feat: Added optional args to logger.log to format string only when log level applies #706

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

Merged
merged 3 commits into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/logging/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ class OptimizelyLogger implements LoggerFacade {
* @param {string} [message]
* @memberof OptimizelyLogger
*/
log(level: LogLevel | string, message: string): void {
log(level: LogLevel | string, message: string, ...splat: any[]): void {
this.internalLog(coerceLogLevel(level), {
message,
splat: [],
splat,
})
}

Expand Down
6 changes: 3 additions & 3 deletions packages/logging/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export enum LogLevel {
}

export interface LoggerFacade {
log(level: LogLevel | string, message: string): void
log(level: LogLevel | string, message: string, ...splat: any[]): void

info(message: string | Error, ...splat: any[]): void

Expand All @@ -38,5 +38,5 @@ export interface LogManager {
}

export interface LogHandler {
log(level: LogLevel, message: string): void
}
log(level: LogLevel, message: string, ...splat: any[]): void
}