Reformat structure
This commit is contained in:
parent
342375d3b1
commit
466dd184b1
|
@ -1 +0,0 @@
|
||||||
export * from "./schema";
|
|
2
src/utils/index.ts
Normal file
2
src/utils/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export * from "./logger";
|
||||||
|
export * from "./utils";
|
30
src/utils/logger.ts
Normal file
30
src/utils/logger.ts
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import chalk from "chalk";
|
||||||
|
|
||||||
|
export class Logger {
|
||||||
|
private _wrn: string;
|
||||||
|
private _err: string;
|
||||||
|
private _main: string;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this._wrn = chalk.yellow("[WARN] ");
|
||||||
|
this._err = chalk.red("[ERROR] ");
|
||||||
|
|
||||||
|
this._main = chalk.bold.gray("[Simple Review Server] ");
|
||||||
|
}
|
||||||
|
|
||||||
|
log(text: any, args?: any): void {
|
||||||
|
args ? console.log(this._main + text, args) : console.log(this._main + text);
|
||||||
|
}
|
||||||
|
|
||||||
|
warn(text: any, args?: any): void {
|
||||||
|
args ? console.warn(this._wrn + this._main + text, args) : console.warn(this._wrn + this._main + text);
|
||||||
|
}
|
||||||
|
|
||||||
|
error(text: any, args?: any): void {
|
||||||
|
args ? console.error(this._err + this._main + text, args) : console.error(this._err + this._main + text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const emp = chalk.green;
|
||||||
|
export const wrn = chalk.yellow;
|
||||||
|
export const err = chalk.red;
|
|
@ -1,5 +1,5 @@
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { Review } from "./types";
|
import { Review } from "../types";
|
||||||
|
|
||||||
export const dir = "./persist/";
|
export const dir = "./persist/";
|
||||||
|
|
Loading…
Reference in a new issue