From b950a0e803efefd2ea4d76c25d3bb531018d7452 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Wed, 27 Mar 2024 16:47:09 +0100 Subject: [PATCH] chore: log error additionally --- lib/Logger.ts | 11 +++++++++-- lib/storage/index.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Logger.ts b/lib/Logger.ts index b83df67fb..a1fff8332 100644 --- a/lib/Logger.ts +++ b/lib/Logger.ts @@ -1,6 +1,6 @@ type LogData = { message: string; - level: 'alert' | 'info'; + level: 'alert' | 'info' | 'hmmm'; }; type LoggerCallback = (data: LogData) => void; @@ -28,4 +28,11 @@ function logInfo(message: string) { logger({message: `[Onyx] ${message}`, level: 'info'}); } -export {registerLogger, logInfo, logAlert}; +/** + * Send an hmmm message to the logger + */ +function logHmmm(message: string) { + logger({message: `[Onyx] ${message}`, level: 'hmmm'}); +} + +export {registerLogger, logInfo, logAlert, logHmmm}; diff --git a/lib/storage/index.ts b/lib/storage/index.ts index 5871e7fb0..f49c97090 100644 --- a/lib/storage/index.ts +++ b/lib/storage/index.ts @@ -20,7 +20,7 @@ type Storage = { * Degrade performance by removing the storage provider and only using cache */ function degradePerformance(error: Error) { - Logger.logAlert(`Error while using ${provider.name}. Falling back to only using cache and dropping storage.`); + Logger.logHmmm(`Error while using ${provider.name}. Falling back to only using cache and dropping storage.\n Error: ${error.message}\n Stack: ${error.stack}\n Cause: ${error.cause}`); console.error(error); provider = MemoryOnlyProvider; }