From 4475fb02925c04ba19cb9ec8b99110e4e74c3acb Mon Sep 17 00:00:00 2001 From: MetaMuffin Date: Thu, 5 Aug 2021 11:00:46 +0200 Subject: updated licence, added all the code --- source/client/logger.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 source/client/logger.ts (limited to 'source/client/logger.ts') diff --git a/source/client/logger.ts b/source/client/logger.ts new file mode 100644 index 0000000..7d61570 --- /dev/null +++ b/source/client/logger.ts @@ -0,0 +1,15 @@ + +export type LogTag = "webrtc" | "ws" | "media" | "*" +const log_tag_color: { [key in LogTag]: string } = { + "*": "#FF0000", + webrtc: "#990099", + media: "#999900", + ws: "#009999" +} + +// TODO maybe log time aswell +export function log(tag: LogTag, message: string, ...data: any[]) { + console.log(`%c[${tag}] ${message}`, "color:" + log_tag_color[tag], ...data); +} + + -- cgit v1.2.3-70-g09d2