Skip to content

Commit

Permalink
add timestamp to error log #316
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 20, 2024
1 parent 9786e1a commit 1819c3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* update `log` to accept two arguments [#301](https://github.com/jcubic/lips/issues/301)
* allow to use `data-bootstrap` attribute on script tags
* make `atan` work for complex numbers
* save error logs in home dir
* add timestamp to error logs
### Bugfix
* fix `let-values` to allow binding to list [#281](https://github.com/jcubic/lips/issues/281)
* fix wrong strings in `string-fill!`
Expand Down
4 changes: 4 additions & 0 deletions bin/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ process.on('uncaughtException', function (err) {

// -----------------------------------------------------------------------------
function log_error(message) {
const date = (new Date()).toISOString();
message = message.split('\n').map(line => {
return `${date}: ${line}`;
}).join('\n');
fs.appendFileSync(path.join(os.homedir(), 'lips.error.log'), message + '\n');
}
// -----------------------------------------------------------------------------
Expand Down

0 comments on commit 1819c3b

Please sign in to comment.