Skip to content

Commit cb7c280

Browse files
Copilotfpfp100
andauthored
Fix test failure after adding event method to ILogger interface (#186)
* Initial plan * Fix test failure by adding event method to ILogger mocks - Updated all mock ILogger objects in custom-logger.test.ts to include the event method - Updated setLogger validation to check for event method - Updated error message to include event method in validation Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com>
1 parent 900d08f commit cb7c280

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

packages/agents-a365-observability/src/utils/logging.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,10 @@ export function setLogger(customLogger: ILogger): void {
201201
!customLogger ||
202202
typeof customLogger.info !== 'function' ||
203203
typeof customLogger.warn !== 'function' ||
204-
typeof customLogger.error !== 'function'
204+
typeof customLogger.error !== 'function' ||
205+
typeof customLogger.event !== 'function'
205206
) {
206-
throw new Error('Custom logger must implement ILogger interface (info, warn, error methods)');
207+
throw new Error('Custom logger must implement ILogger interface (info, warn, error, event methods)');
207208
}
208209
globalLogger = customLogger;
209210
}

tests/observability/core/custom-logger.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ describe('Custom Logger Support', () => {
8686

8787
describe('Global Logger Management', () => {
8888
it('should set and get custom logger', () => {
89-
const custom: ILogger = { info: jest.fn(), warn: jest.fn(), error: jest.fn() };
89+
const custom: ILogger = { info: jest.fn(), warn: jest.fn(), error: jest.fn(), event: jest.fn() };
9090

9191
setLogger(custom);
9292
expect(getLogger()).toBe(custom);
9393
});
9494

9595
it('should reset to default logger', () => {
96-
const custom: ILogger = { info: jest.fn(), warn: jest.fn(), error: jest.fn() };
96+
const custom: ILogger = { info: jest.fn(), warn: jest.fn(), error: jest.fn(), event: jest.fn() };
9797
setLogger(custom);
9898

9999
resetLogger();
@@ -111,7 +111,8 @@ describe('Custom Logger Support', () => {
111111
const customLogger: ILogger = {
112112
info: jest.fn(),
113113
warn: jest.fn(),
114-
error: jest.fn()
114+
error: jest.fn(),
115+
event: jest.fn()
115116
};
116117

117118
setLogger(customLogger);
@@ -130,7 +131,8 @@ describe('Custom Logger Support', () => {
130131
const selectiveLogger: ILogger = {
131132
info: () => {},
132133
warn: jest.fn(),
133-
error: () => {}
134+
error: () => {},
135+
event: () => {}
134136
};
135137

136138
setLogger(selectiveLogger);
@@ -149,7 +151,8 @@ describe('Custom Logger Support', () => {
149151
const customLogger: ILogger = {
150152
info: jest.fn(),
151153
warn: jest.fn(),
152-
error: jest.fn()
154+
error: jest.fn(),
155+
event: jest.fn()
153156
};
154157

155158
new ObservabilityBuilder()

0 commit comments

Comments
 (0)