From 12effd89497053ee353a10aed16d468fcf12647b Mon Sep 17 00:00:00 2001 From: Marius Kleidl Date: Tue, 16 Apr 2024 12:14:21 +0200 Subject: [PATCH] Move logger.js to TypeScript --- lib/browser/index.js | 2 +- lib/{logger.js => logger.ts} | 4 ++-- lib/node/index.js | 2 +- lib/upload.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename lib/{logger.js => logger.ts} (60%) diff --git a/lib/browser/index.js b/lib/browser/index.js index a3908545..48ef2ed8 100644 --- a/lib/browser/index.js +++ b/lib/browser/index.js @@ -1,6 +1,6 @@ import BaseUpload from '../upload.js' import NoopUrlStorage from '../noopUrlStorage.js' -import { enableDebugLog } from '../logger.js' +import { enableDebugLog } from '../logger' import DetailedError from '../error.js' import { canStoreURLs, WebStorageUrlStorage } from './urlStorage.js' diff --git a/lib/logger.js b/lib/logger.ts similarity index 60% rename from lib/logger.js rename to lib/logger.ts index bd58df46..c10fe9d0 100644 --- a/lib/logger.js +++ b/lib/logger.ts @@ -2,11 +2,11 @@ let isEnabled = false -export function enableDebugLog() { +export function enableDebugLog(): void { isEnabled = true } -export function log(msg) { +export function log(msg: string): void { if (!isEnabled) return console.log(msg) } diff --git a/lib/node/index.js b/lib/node/index.js index 3486b2d4..a74c9292 100644 --- a/lib/node/index.js +++ b/lib/node/index.js @@ -1,6 +1,6 @@ import BaseUpload from '../upload.js' import NoopUrlStorage from '../noopUrlStorage.js' -import { enableDebugLog } from '../logger.js' +import { enableDebugLog } from '../logger' import DetailedError from '../error.js' import { FileUrlStorage, canStoreURLs } from './urlStorage.js' diff --git a/lib/upload.js b/lib/upload.js index f7c43111..e64dbd00 100644 --- a/lib/upload.js +++ b/lib/upload.js @@ -1,7 +1,7 @@ import { Base64 } from 'js-base64' import URL from 'url-parse' import DetailedError from './error.js' -import { log } from './logger.js' +import { log } from './logger' import uuid from './uuid' const PROTOCOL_TUS_V1 = 'tus-v1'