From 0b21e3a24636cb40394039c05048a9c1169e4277 Mon Sep 17 00:00:00 2001 From: Pascal Perrenoud Date: Tue, 21 May 2024 15:48:27 +0200 Subject: [PATCH] Add log --- index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index c6690b2..2fedef4 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,7 @@ import {Result} from 'result' +import logger from 'log' + +const log = logger('misc') export function a2str(buf: Uint8Array) : string { // @ts-ignore @@ -18,9 +21,14 @@ export function a2b64(buf: Uint8Array) : string { return btoa(a2str(buf)) } export function b642a(b64: string) : Result { + log.trace('b642a') + try { return Result.ok(str2a(atob(b64))) - } catch (e) {} + } catch (e) { + log.warn('b64 decode failed') + log.debug(`error : ${e}`) + } return Result.error([]) }