A simple logger you can use to log stuff in the console
yarn add / npm install @daangamesdg/logger
Basic Usage
import { Logger } from "@daangamesdg/logger";
const logger = new Logger({ name: "name", timestamp: true }); // options: { name: string; timestamp?: boolean (default = true) }
logger.info(anything, you, like);
Extending
/* CustomFormatter.ts */
import { Structure } from "@daangamesdg/logger";
Structure.extend(
"Formatter",
(Formatter) =>
class CustomFormatter extends Formatter {
// do what ever you want here
// example
public test(): void {
console.log("test");
}
}
);
declare module "@daangamesdg/logger" {
class Formatter {
test(): void;
}
}
/* index.ts */
import "absolute/path/to/CustomFormatter";
import { Formatter } from "@daangamesdg/logger";
const formatter = new Formatter().test();
logger.test(); // logs "test"
Note: the examples writting in TypeScript
👤 DaanGamesDG
- Website: https://daangamesdg.xyz/
- Email: [email protected]
- Twitter: @DaanGamesDG
- Github: @DaanGamesDG
Project is licensed under the © MIT License