flaps-logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Table of contents

FlapsLogger

A Advanced Javascript Utility Logger.

How to use

install the package into your project

npm install flaps-logger

After installing import and create the Logger by using the createLogger function

const FlapsLogger = require("flaps-logger");
const logger = FlapsLogger.createLogger(options);

to Log something use the either info, warn, error, failure, debug to log something into the console about something in your code

logger.info("Hi from FlapsLogger");

You should see this in the terminal.

[$DATE] / INFO: Hi from FlapsLogger

And your done.

Use Log files

to use log files you gotta edit the options.

const Logger = FlapsLogger.createLogger({ writeLogFile: true });

This will make the logger write to a file called log.txt
to Change the name of the file use the FlapsLogger#setLogFile function

Logger.setLogFile(pathLike);

And now if you send out something into the console it should be written to a log file named whatever you set it.

Updating Logger format

to Update logger's format update the options format function.

const Logger = FlapsLogger.createLogger({ format: (type, message, date) => {
    return `${type}: ${message} / ${date}`; // This is an example
}});

Now when ever you write something or use the log functions it should use your format.

Readme

Keywords

Package Sidebar

Install

npm i flaps-logger

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

6.74 kB

Total Files

7

Last publish

Collaborators

  • palescript