Make Logger origin mutable
This commit is contained in:
parent
227fd5f464
commit
6d60dd9966
|
@ -5,7 +5,7 @@ import { Review, reviewSchema } from "./types";
|
||||||
import { checkFile, emp, Logger, Responder } from "./utils";
|
import { checkFile, emp, Logger, Responder } from "./utils";
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
const logger = new Logger();
|
const logger = new Logger("Simple Review Server");
|
||||||
const response = new Responder();
|
const response = new Responder();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const port = +process.env.PORT ?? 8080;
|
const port = +process.env.PORT ?? 8080;
|
||||||
|
|
|
@ -5,11 +5,11 @@ export class Logger {
|
||||||
private _err: string;
|
private _err: string;
|
||||||
private _main: string;
|
private _main: string;
|
||||||
|
|
||||||
constructor() {
|
constructor(origin?: string) {
|
||||||
this._wrn = chalk.yellow("[WARN] ");
|
this._wrn = chalk.yellow("[WARN] ");
|
||||||
this._err = chalk.red("[ERROR] ");
|
this._err = chalk.red("[ERROR] ");
|
||||||
|
|
||||||
this._main = chalk.bold.gray("[Simple Review Server] ");
|
this._main = chalk.bold.gray(`[${origin ?? "Anonymous"}] `);
|
||||||
}
|
}
|
||||||
|
|
||||||
public log(text: any, args?: any): void {
|
public log(text: any, args?: any): void {
|
||||||
|
|
Loading…
Reference in a new issue