32 Commits

Author SHA1 Message Date
Lam Wei Li
243592baf9
fix: tilde expansion 2023-02-20 02:03:10 +08:00
Zachary Haber
cad9555948
style: run prettier:fix 2022-06-23 01:00:07 +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
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
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
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
e3a36db232
chore(validation): added filename validation for fileAppender and filesyncAppender 2022-03-06 21:35:11 +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
287c3eb836
Fixed fileSync appender to create directory recursively 2022-03-01 01:39:38 +08: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
peteriman
8042252861
Changed default file modes from 0o644 to 0o600 for better security 2022-01-16 22:09:32 +08:00
Gareth Jones
66fe30e9f4 chore: oh shit I changed the eslint rules 2019-08-01 16:57:32 +10:00
Martin Heidegger
a06e2cc83c chore: updated dependencies (including eslint) 2019-02-20 23:07:23 +09:00
Rami Cohen
dc2079e4c1 fix(fileSync): options not used 2017-11-12 11:30:06 -07:00
Gareth Jones
1d50b82a96 refactor: fixed a few more appenders 2017-02-07 08:53:51 +11:00
e-cloud
7d9dc55ff2 style: upgrade eslint and format the code
no logic changed.
2016-12-12 21:04:34 +08:00
e-cloud
02d6c017f4 Merge branch 'master'
Conflicts:
	.travis.yml
	lib/appenders/dateFile.js
	lib/appenders/file.js
	lib/appenders/fileSync.js
	lib/appenders/gelf.js
	lib/appenders/logFacesAppender.js
	lib/date_format.js
	lib/debug.js
	lib/layouts.js
	lib/log4js.js
	lib/log4js.json
	lib/logger.js
	lib/streams/BaseRollingFileStream.js
	lib/streams/DateRollingFileStream.js
	lib/streams/RollingFileStream.js
	lib/streams/index.js
	package.json
	test/layouts-test.js
	test/streams/BaseRollingFileStream-test.js
	test/streams/DateRollingFileStream-test.js
	test/streams/rollingFileStream-test.js
2016-12-12 17:42:34 +08:00
Gareth Jones
2b84671471 changed default appender to stdout, replaced streams with streamroller, started removal of vows tests 2016-10-23 11:50:53 +11:00
e-cloud
9cc3a88bd7 refactor: more small refactor
1. drop semver related code with no need to detect node version
2. drop license declaration in log4js.js for there is one in the project dir
3. other changes
2016-07-16 13:49:24 +08:00
e-cloud
c80877e6b7 refactor: appenders/fileSync.js 2016-07-15 20:10:57 +08:00
e-cloud
5328e03802 refactor: just format code according to the editor config(tests passed) 2016-07-14 17:36:30 +08:00
Gareth Jones
97fc892c00 fixing some jshint errors 2016-04-29 09:11:17 +10:00
Quentin Brandon
af69eddd1c Add optional timezoneOffset config for appenders
Example:
    log4js.configure({
        appenders: [{type: 'console', timezoneOffset: -540}],
        replaceConsole: true
    });

The expected value is the equivalent of (new Date).getTimezoneOffset()
In this example, -540 is the value for JST.
This allows machines members of world-wide-spread cluster to all report
log time-stamps using the same timezone (or adapt the timezone to a
local different from the system)
2015-03-20 11:51:23 +09:00
Maycon Bordin
7fcdb2e651 fixed a issue with the encoding on node 0.8 2013-12-12 22:26:48 -02:00
Maycon Bordin
60a84f16cf added tests for the fileSync appender and changed the behavior of fileSync to create an empty log when called, just like the file appender does 2013-12-12 18:16:53 -02:00
Maycon Bordin
723dbec964 added a synchronous file appender 2013-12-06 12:48:49 -02:00