coffee-logger
v0.0.1
Published
`coffee-logger` is a JavaScript micro package that defines a simple logging interface
Downloads
1
Readme
Coffe-Logger
coffee-logger
is a JavaScript micro package that defines a simple logging interface
Usage
Implement LogImplement
interface from index.js
import { LogApp, LogHandler, LogImplement, LogLocal, LogMessage, SetupLogger, SendLog, CatchLog } from "coffee-logger"
export class MyLogger implements LogImplement {
//todo: IMPLEMENT
generateInfo(caller : LogLocal) : string {
//todo
}
onSendMessage(msg : LogMessage) : Promise<void> {
//todo
}
onCatchMessage(callback : LogHandler) : void {
//todo
}
}
//setup logger init
SetupLogger(new MyLogger(), new LogApp("my-app"));
//to send a log use 'SendLog'
SendLog("error", "This is an error log");
//use 'Catch Log' to recieve logged messages
CatchLog(log => {
console.log(log.message);
})