feat: adds proper logging support

This commit is contained in:
Sampson committed 2025-08-14 09:33:58 -05:00
1 parent 8ad2521abc
commit a94e4dadab
13 files changed
+187 -38

No files matched your search

+4 -3
View File
@@ -5,7 +5,8 @@ import type {
} from '@modelcontextprotocol/sdk/types.js';
import params, { type QueryParams } from './params.js';
import API from '../../BraveAPI/index.js';
import { log, stringify } from '../../utils.js';
import { stringify } from '../../utils.js';
import ClientLogger from '../../ClientLogger.js';
export const name = 'brave_image_search';
@@ -44,7 +45,7 @@ export const execute = async (params: QueryParams) => {
};
async function fetchImage(url: string): Promise<{ mimeType: string; data: string } | null> {
await log('info', `Fetching image data from ${url}`);
await ClientLogger.log('info', `Fetching image data from ${url}`);
try {
const response = await fetch(url);
const buffer = await response.arrayBuffer();
@@ -53,7 +54,7 @@ async function fetchImage(url: string): Promise<{ mimeType: string; data: string
mimeType: response.headers.get('content-type') ?? 'image/jpeg',
};
} catch (error) {
await log('error', `Error fetching image data from ${url}: ${error}`);
await ClientLogger.log('error', `Error fetching image data from ${url}: ${error}`);
return null;
}
}