import { ObservableInterface } from "@hibas123/utils"; import { Colors } from "./index"; import { Adapter, LoggingTypes, Message } from "./types"; export class ConsoleWriter implements Adapter { init(observable: ObservableInterface) { observable.subscribe(this.onMessage.bind(this)); } flush() { } onMessage(message: Message) { let lines = message.text.formatted; let name = ""; if (message.name) name = `[${message.name}]=>`; lines.forEach(line => console.log(name + line + Colors.Reset)) } }