aboutsummaryrefslogtreecommitdiff
path: root/source/client/logger.ts
diff options
context:
space:
mode:
Diffstat (limited to 'source/client/logger.ts')
-rw-r--r--source/client/logger.ts15
1 files changed, 15 insertions, 0 deletions
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);
+}
+
+