1.0.6 • Published 5 months ago

filewriter-siawwad v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Users can import this module into their Node.js scripts and utilize the functions to create new log every hour, ensuring organized and time-stamping logs.

MODULE FEATURES:

Automatically creates a new log file every hour.

Handles data asynchronously.

Provides the flexibility to set a custom log directory.

Incorporates an execution timer to measure the duration of each process.

Usage:

Include it in your project

const fileWriter = require('filewriter-siawwad');

Setting a custom log directory (optional)

fileWriter.setLogDir('your dir path');

Note: the default directory is 'Logs', ensure that the directory is exists and is writable.

logging data

const dataToLog = 'This is a log message.';
fileWriter.logData('data to log');

The 'startTimer' function is responsible for initiating the timer. When called, it records the current timestamp, marking the beginning of the logging process.

fileWriter.startTimer();

the 'endTimer' function is responsible for concluding the timer. When called, it records the current timestamp, marking the end of the logging process. Subsequently, it calculates the duration between the start and end times.

fileWriter.endTimer('your label');

The duration between the start and end times is automatically calculated and logged as part of the 'endTimer' function. This information (plus the timestamp of each operation) is valuable for assessing the efficiency of the logging process.

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

6 months ago