Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.1.0: Saving Everything #1

Merged
merged 3 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# V1.1
- Added support for logging to a file

- [NEW] Added the `fileProperties` parameter to the `Logger` constructor which includes the following properties:

- enable: enable logging to a file (defaults to `false`) [If `false` all the other properties will be ignored]

- logFolderPath: path to the folder where the log files will be stored (will be created if it doesn't exist, defaults to `./logs`)

- enableLatestLog?: if true, the latest log file will be stored in the `logFolderPath` with the name `latest.log` (defaults to `true`)

- enableDebugLog?: if true, the debug log will be stored in the `logFolderPath` inside a folder named `latestLogs` with the name `debug.log` (defaults to `true`)

- enableErrorLog?: if true, the error log will be stored in the `logFolderPath` inside a folder named `latestLogs` with the name `error.log` (defaults to `false`)

- enableFatalLog?: if true, the fatal log will be stored in the `logFolderPath` inside a folder named `fatal-crash` with the name `fatal-DATE.log` (defaults to `true`)

- generateHTMLLog?: if true, the log files will be generated in HTML format (their extension will change from .log to .html) (defaults to `false`)

- compressLogFilesAfterNewExecution?: if true, the log files will be compressed to a zip file after a new execution of the program (defaults to `true`)

- [NEW] Added support to log objects, arrays and etc. Like the default `console.log` function.

- [BREAKING] Changed the export of AutoLogEnd now importing the package will return the `Logger` class and a object named `AutoLogEnd` with the `activate` and `deactivate` functions.

- [NEW] AutoLogEnd `activate` function now accepts a `Logger` instance as 2º parameter. If not passed it will create a new instance of `Logger` with the default parameters. otherwise it will use the passed instance.

# V1.0

- Initial release of logger
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,19 @@ import { Logger } from '@promisepending/logger.js';
const logger = new Logger({
prefix: 'Logger.JS', // This will be the prefix of all logs (default: null)
disableFatalCrash: true, // If true, the logger will not crash the process when a fatal error occurs (default: false)
// ...
allLineColored: true, // If true, the whole line will be colored instead of only the prefix (default: false)
coloredBackground: false, // If true, the background of the lines will be colored instead of the text (default: false)
debug: false, // If true, the logger will log debug messages (default: false)
fileProperties: { // This is the configuration of the log files
enable: true, // If true, the logger will log to files (default: false) [NOTE: If false all below options will be ignored]
logFolderPath: './logs', // This is the path of the folder where the log files will be saved (default: './logs')
enableLatestLog: true, // If true, the logger will save the latest log in a file (default: true)
enableDebugLog: true, // If true, the logger will save the debug logs in a file (default: false)
enableErrorLog: true, // If true, the logger will save the error logs in a file (default: false)
enableFatalLog: true, // If true, the logger will save the fatal logs in a file (default: true)
generateHTMLLog: true, // If true, the logger will generate a HTML file with the logs otherwise a .log file (default: false)
compressLogFilesAfterNewExecution: true, // If true, the logger will compress the log files to zip after a new execution (default: true)
},
});
```

Expand Down Expand Up @@ -128,6 +140,4 @@ logger.fatal('This is a fatal message');

#

<p align="center">Made with 💚 By PromisePending™'s team.</p>

<p align="center">All Reserved Rights.</p>
<p align="center">Made with 💜 By PromisePending™'s team.</p>
Loading