Skip to content

Commit 3ba03b3

Browse files
committed
Indicate success when setting context properties
1 parent d985dfc commit 3ba03b3

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/lib/logger/logger.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,36 @@ export default class Logger {
146146
return this.context?.getProperty(name);
147147
}
148148

149-
setContextProperty(name: string, value: string) {
150-
this.context?.setProperty(name, value);
149+
setContextProperty(name: string, value: string) : boolean {
150+
if (this.context) {
151+
this.context.setProperty(name, value);
152+
return true
153+
}
154+
return false
151155
}
152156

153157
getCorrelationId(): string | undefined {
154158
return this.getContextProperty("correlation_id");
155159
}
156160

157-
setCorrelationId(value: string) {
158-
this.setContextProperty("correlation_id", value);
161+
setCorrelationId(value: string) : boolean {
162+
return this.setContextProperty("correlation_id", value);
159163
}
160164

161165
getTenantId(): string | undefined {
162166
return this.getContextProperty("tenant_id");
163167
}
164168

165-
setTenantId(value: string) {
166-
this.setContextProperty("tenant_id", value);
169+
setTenantId(value: string) : boolean {
170+
return this.setContextProperty("tenant_id", value);
167171
}
168172

169173
getTenantSubdomain(): string | undefined {
170174
return this.getContextProperty("tenant_subdomain");
171175
}
172176

173-
setTenantSubdomain(value: string) {
174-
this.setContextProperty("tenant_subdomain", value);
177+
setTenantSubdomain(value: string) : boolean {
178+
return this.setContextProperty("tenant_subdomain", value);
175179
}
176180

177181
private getCustomFieldsFromLogger(logger: Logger): Map<string, any> {

0 commit comments

Comments
 (0)