pixl-logger
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -94,3 +94,4 @@ // Generic Logger Class for Node.JS | ||
// append to log | ||
fs.appendFile(path, line); | ||
if (this.args.sync) fs.appendFileSync(path, line); | ||
else fs.appendFile(path, line); | ||
@@ -97,0 +98,0 @@ // echo to console if desired |
{ | ||
"name": "pixl-logger", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A simple logging class which generates [bracket][delimited] log columns.", | ||
@@ -5,0 +5,0 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>", |
@@ -249,2 +249,14 @@ # Overview | ||
## Sync or Async | ||
By default, the logger will append to your log files asynchronously. This has the benefit of not blocking your main thread, and can help if your log drive is suffering lag or high I/O wait. But it *may* cause issues with log entries appearing out of order for extremely high traffic apps, and also some final log entries may be lost if `process.exit()` is called *immediately* after. | ||
To get around these potential issues, you can write log entries synchronously. Just set the `sync` arg to true: | ||
```javascript | ||
logger.set( 'sync', true ); | ||
logger.debug( 1, "This will be logged synchronously, even if we exit right NOW!" ); | ||
process.exit(0); | ||
``` | ||
# License | ||
@@ -251,0 +263,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21089
260
284