416 Commits

Author SHA1 Message Date
gabriel-cloud
cd8b019e3f add maxLength to recording 2023-05-19 22:02:24 +00:00
aje
d0f5b70b1d Idempotent logging on browser
Certain modules do not exist in a browser environment.
In that environment, file-based appenders are effectively
disabled by this commit, without modifying the source directly.
2023-03-07 14:26:12 +08:00
Lam Wei Li
243592baf9
fix: tilde expansion 2023-02-20 02:03:10 +08:00
Lam Wei Li
2523e17a15
chore(deps-dev): bump prettier from 1.19.1 to 2.7.1 2022-09-28 17:22:38 +08:00
Lam Wei Li
4bc5589a28
style: ran prettier 2022-07-26 03:07:06 +08:00
Lam Wei Li
60c9e53da0
fix: load CJS appenders for ESM projects 2022-07-04 01:26:32 +08:00
Zachary Haber
cad9555948
style: run prettier:fix 2022-06-23 01:00:07 +08:00
Lam Wei Li
e378b597a6
style: prepare for prettier:fix 2022-06-23 01:00:00 +08:00
Lam Wei Li
d718d84359
fix: fs.appendFileSync should use flag instead of flags 2022-05-23 14:22:34 +08:00
Lam Wei Li
a0eceefed1
feat: tilde expansion for filename 2022-05-22 16:40:06 +08:00
Lam Wei Li
d182204079
fix: filename validation (cannot be directory) 2022-05-22 16:23:48 +08:00
Lam Wei Li
6de1da298e
refactor: code flow and readability 2022-05-22 16:18:13 +08:00
Lam Wei Li
505204addc
style: white-space 2022-05-22 16:18:10 +08:00
Lam Wei Li
2905e0c12f
chore(fix): dateFileAppender unable to use units in maxLogSize 2022-05-13 03:36:33 +08:00
Tobias Speicher
aeff6dc882
refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-27 01:47:47 +01:00
Lam Wei Li
7534f9c25f
chore(test): added test coverage for deprecation notices 2022-03-15 15:57:53 +08:00
Lam Wei Li
e58a48a63e
Merge pull request #1210 from log4js-node/optimise
chore(optimise): do not initialise default appenders as it will be done again by configure()
2022-03-15 15:56:28 +08:00
Lam Wei Li
4b400523b8
chore(optimise): do not initialise default appenders as it will be done again by configure() 2022-03-15 15:50:46 +08:00
Lam Wei Li
6d867f5caf
chore(docs): added docs for istanbul ignore 2022-03-14 17:15:44 +08:00
Lam Wei Li
cbfffd4d71
chore(dev): bump eslint-config-airbnb-base from 13.2.0 to 15.0.0 2022-03-14 16:31:03 +08:00
Lam Wei Li
3291aae870
chore(lint): should not disable eslint rule, prefer-arrow-callback, in file-level 2022-03-12 15:43:37 +08:00
Lam Wei Li
e38f1c5aa9
chore(lint): should not disable eslint rule, no-unused-var, in file-level 2022-03-12 15:43:22 +08:00
Lam Wei Li
235656df8d
chore(lint): should not disable eslint rule, no-cond-assign, in file-level 2022-03-12 15:43:05 +08:00
Lam Wei Li
4f1111ee40
chore(lint): added specific eslint rule(s) to disable for clarity 2022-03-12 01:25:39 +08:00
Lam Wei Li
e78dbf50c0
chore(test): improve test coverage for fileSyncAppender
removed redundant default value for EOL to avoid branch coverage issues in fileSync.js
2022-03-12 01:16:36 +08:00
Lam Wei Li
3533d159c3
chore(test): improve test coverage for fileSyncAppender
used a simpler compare function to avoid branch coverage issues in fileSync.js
2022-03-12 01:12:45 +08:00
Lam Wei Li
8ad41831d1
chore(test): improve test coverage for fileSyncAppender
appenders/fileSync.js - Line 58 - throw new Error(`maxLogSize (${maxLogSize}) should be > 0`);
2022-03-08 17:22:12 +08:00
Lam Wei Li
6e6dbad5d3
chore(test): improve test coverage for multiFileAppender
(else path will never be taken)

appenders/multiFile.js - Line 17 - /* istanbul ignore else */
appenders/multiFile.js - Line 18 - if (timer && app) {
2022-03-08 15:39:42 +08:00
Lam Wei Li
04bd18b44d
chore(test): improve test coverage for appenders/index
(requires truthy value, used a noop function, but the function never gets called anyway)

appenders/index.js - Line 95 - }, /* istanbul ignore next */ () => {});
2022-03-06 21:47:28 +08:00
Lam Wei Li
e45086765e
Merge pull request #1201 from log4js-node/filename-validation
chore(validation): added filename validation
2022-03-06 21:45:43 +08:00
Lam Wei Li
e3a36db232
chore(validation): added filename validation for fileAppender and filesyncAppender 2022-03-06 21:35:11 +08:00
Lam Wei Li
4bc77b68a9
chore(refactor): fileAppender to have same internal code ordering as fileSyncAppender 2022-03-06 21:22:55 +08:00
Lam Wei Li
8d2a211a9f
chore(refactor): fileSyncAppender to have same internal code ordering as fileAppender 2022-03-06 21:22:08 +08:00
Lam Wei Li
704e15e383
Merge pull request #1198 from log4js-node/update-tcp-server
Removed redundant logic in tcp-serverAppender
2022-03-04 21:48:29 +08:00
Lam Wei Li
6b2344f2f9
Removed redundant logic in tcp-serverAppender 2022-03-04 21:39:36 +08:00
Lam Wei Li
b705fa57c7
Removed redundant logic in multiprocessAppender 2022-03-03 21:34:56 +08:00
Lam Wei Li
287c3eb836
Fixed fileSync appender to create directory recursively 2022-03-01 01:39:38 +08:00
Lam Wei Li
ca97feedfc
Merge pull request #1184 from log4js-node/update-test
chore(test): improve test coverage
2022-02-08 15:22:35 +08:00
Lam Wei Li
89e70e7fb8
chore(test): improve test coverage for multiFileAppender
appenders/multiFile.js - Line 53 - timers.get(fileKey).lastUsed = Date.now();
appenders/multiFile.js - Line 70 - clearInterval(timer.interval);
2022-02-05 16:01:44 +08:00
Lam Wei Li
d6f500c5dc
chore(refactor): removed comments 2022-02-04 17:54:35 +08:00
Lam Wei Li
eb9c923b04
Misc formatting 2022-02-02 03:06:22 +08:00
Lam Wei Li
57c9025913
Fixes #1029 2022-02-02 03:06:07 +08:00
Lam Wei Li
8b44299454
Fixes #1086 2022-02-02 03:05:42 +08:00
Lam Wei Li
adcd0ffeaf
Merge pull request #1165 from log4js-node/fixed-eslint
fixed eslint
2022-01-23 21:42:27 +08:00
Lam Wei Li
bf2b326e51
fixed eslint 2022-01-23 21:35:21 +08:00
Lam Wei Li
3226b3de40
emit deprecation 2022-01-23 21:26:45 +08:00
Nico Jansen
f127382fa8
fix(multiprocess): startup multiprocess even when no direct appenders attached
Fixes #1161
2022-01-23 00:20:19 +01:00
Lam Wei Li
ac599e42c6
allow for zero backup - in sync with https://github.com/log4js-node/streamroller/pull/74
**Important**
It is also to note the file does not roll within itself (truncate its older entry for newer entry).
It truncates all and appends only the new entry.

```javascript
var rollers = require('streamroller');
var stream = new rollers.RollingFileStream('myfile', 6, 0);
stream.write("abc"); // add as first row
stream.write("def"); // add as second row
stream.write("ghi"); // truncate all and add as first row
stream.end();
```

Output:
```
myfile   - ghi
```
2022-01-20 01:47:15 +08:00
Lam Wei Li
4c4bbe84e8
chore(refactor): using writer.writable instead of alive for checking 2022-01-19 21:55:06 +08:00
Lam Wei Li
e86a809544
Merge pull request #1097 from 4eb0da/datefile-error-handling
dateFile error handling fix
2022-01-19 21:26:03 +08:00