Skip to content

Commit 352a48f

Browse files
authored
chore: fix logger export to make it mockable. (#1766)
1 parent bd981cc commit 352a48f

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/logger/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,17 @@ function entryFromArgs(severity: LogSeverity, args: any[]): LogEntry {
178178
}
179179
return out;
180180
}
181+
182+
/**
183+
* Logger object containing all logging methods.
184+
*
185+
* Mockable for testing purposes.
186+
*/
187+
export const logger = {
188+
write,
189+
debug,
190+
log,
191+
info,
192+
warn,
193+
error,
194+
};

src/v2/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
* @packageDocumentation
2929
*/
3030

31-
import * as logger from "../logger";
3231
import * as alerts from "./providers/alerts";
3332
import * as database from "./providers/database";
3433
import * as eventarc from "./providers/eventarc";
@@ -50,7 +49,6 @@ export {
5049
https,
5150
identity,
5251
pubsub,
53-
logger,
5452
tasks,
5553
eventarc,
5654
scheduler,
@@ -60,6 +58,7 @@ export {
6058
dataconnect,
6159
};
6260

61+
export { logger } from "../logger";
6362
export { setGlobalOptions } from "./options";
6463
export type {
6564
GlobalOptions,

0 commit comments

Comments
 (0)