65 Commits

Author SHA1 Message Date
Lam Wei Li
2628688852
fix(7922e82): regex for stacktrace 2023-03-08 23:13:51 +08:00
Lam Wei Li
7922e82578
fix: flagged regex by codeql for security and performance 2023-02-20 02:04:20 +08:00
Lam Wei Li
ffa9e5e2e4
refactor: typeof to check for undefined (because undefined can be a variable name) 2022-10-01 18:38:14 +08:00
Zachary Haber
b1598c04c7
feat: add error to logging event from logger 2022-09-30 00:55:20 +08:00
Zachary Haber
b139aafcab
feat: setParseCallStackFunction(undefined) will restore the default behavior 2022-09-29 23:27:49 +08:00
Zachary Haber
d53495a8ab
fix: setParseCallStackFunction will no longer allow invalid values
if set to an invalid value, it'll throw an error immediately, instead of later.
2022-09-29 23:27:49 +08:00
Zachary Haber
a17c8e5e6f
feat: allow setting how deeply a logger should search into the stack
`logger.callStackLinesToSkip = 2` will make it skip 2 extra lines above the base.

You can't skip negative lines

Refs: #1268
2022-09-29 23:27:48 +08:00
Zachary Haber
89b8a58f3f
feat: use data Error for callStack information
use the first data value if an Error to get callstack info. Only 1 line will be stripped from it by default

Refs: #1268
2022-09-29 23:27:47 +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
462e35a1fb
refactor(#1316): code flow and readability (%C:class, %M:function, %A:alias, %F:full - in order) 2022-09-01 21:54:54 +08:00
Pawel Soltys
03b3f50870 FEAT: added %F field containing fully qualified caller name 2022-08-29 15:11:04 +02:00
Pawel Soltys
396a4de469 FEAT: patternLayout function name, class name and function alias
Added to patternLayout the following fields:

- %M - function name of the caller issuing the logging request
- %C - class name of the caller issuing the logging request
- %A - function alias of the caller issuing the logging request

The first two come from log4j, and use the same field specifiers.

When called from method bar of a Class foo:

- %M will be replaced with bar
- %C will be replaced with Foo
- %A will be empty

When called from function foo:

- %M will be replaced with foo
- %C will be empty
- %A will be empty

%A will be non empty only if the call stack parsed to obtain the values
contains string [as foo].
2022-08-27 22:00:53 +02:00
Lam Wei Li
4bc5589a28
style: ran prettier 2022-07-26 03:07:06 +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
e6eee6d2cf
refactor: clearer logic for invalid level and LOG synonym 2022-05-29 12:06:04 +08:00
Lam Wei Li
2825f7c9e4
feat: logger.log() to be synonym of logger.info() 2022-05-22 18:08:37 +08:00
Lam Wei Li
70dc7b8736
fix: fallback for logger.log outputs nothing 2022-05-20 01:09:24 +08:00
Lam Wei Li
f6095a3942
chore(refactor): default level should be OFF 2022-03-21 13:18:08 +08:00
Lam Wei Li
6d867f5caf
chore(docs): added docs for istanbul ignore 2022-03-14 17:15:44 +08:00
Lam Wei Li
4c14bde0bb
chore(lint): moved eslint rule, no-underscore-dangle, with exceptions declared, to file-level 2022-03-12 16:00:40 +08:00
Lam Wei Li
442bab55b8
chore(test): improve test coverage for logger
lib/logger.js - Line 25 - catch (err) {
lib/logger.js - Line 26 -   // will never get error unless nodejs has breaking changes to Error
lib/logger.js - Line 27 -   console.error('log4js.logger - defaultParseCallStack error', err); // eslint-disable-line no-console
lib/logger.js - Line 28 - }
lib/logger.js - Line 29 - return null;
2022-03-12 00:39:51 +08:00
abernh
76f91427ba fix(logger.log): warn on invalid log-level
a warning is logged if the `log` method is used with an unknown log-level
this happens whenever people confuse the `log` method with yet another log-level-short method (like in the browser console.log)
adjusted `newLevel-test` accordingly

rel: https://github.com/log4js-node/log4js-node/issues/1042

Signed-off-by: abernh <a.bernhard@23go.de>
2021-02-23 12:02:15 +01:00
Gareth Jones
8db199f08f chore: more eslint fallout 2019-08-07 08:26:04 +10:00
Gareth Jones
66fe30e9f4 chore: oh shit I changed the eslint rules 2019-08-01 16:57:32 +10:00
Gareth Jones
42d38e6236 docs: fixed a couple of spelling errors 2019-07-10 08:46:15 +10:00
Romain
4f9e2a3b86 feat: allow to change default way to parse callstack 2019-07-09 11:54:38 +02:00
Gareth Jones
b51d8b0994 chore: removed unused lines 2019-05-23 08:15:13 +10:00
Jimmy Huang
ea6cbf06b0 test: add output '' when callstack info not exist 2019-05-20 11:39:19 +08:00
Jimmy Huang
c49ea03ca6 revert: remove global useCallStack 2019-05-17 15:10:39 +08:00
Jimmy Hunag
a564ce4b5f test: add & fix test 2019-05-16 23:30:16 +08:00
Jimmy Huang
911693f294 chore: fix typo 2019-05-16 10:44:54 +08:00
Jimmy Hunag
ea0028b1cb test: add callsite for devDeps & cover logger-test 2019-05-16 01:59:03 +08:00
Jimmy Hunag
5da824e2ff feat: add line number, column position and filename support 2019-05-16 00:45:46 +08:00
Gareth Jones
7234e3ada3 chore(coverage): removed unused check 2018-02-08 08:30:42 +11:00
Gareth Jones
8084e80027 fix(tests): tests failing - config listeners not working in sandbox 2018-01-17 08:24:50 +11:00
Gareth Jones
319562914b fix(tcp): interim commit while I work on something else 2017-12-12 08:03:57 +11:00
Gareth Jones
6f4dfeaafc Merge branch 'master' into tcp-refactor 2017-11-21 08:17:47 +11:00
Gareth Jones
8627f743ef fix(#614): bumped deps of debug, date-format, streamroller 2017-11-17 08:47:45 +11:00
Gareth Jones
aeed9d6c92 fix(tcp): moved serialisation code to logevent 2017-10-12 08:31:54 +11:00
Gareth Jones
f266757fcf fix(cluster): add flag to turn off the cluster support 2017-09-25 09:47:03 +10:00
Gareth Jones
3de180710d fix(#501): don't break when objects are weird 2017-07-14 08:50:41 +10:00
Gareth Jones
58e65543fa fix(cluster): removed cluster appender, moved cluster handling into core 2017-07-07 08:48:17 +10:00
Gareth Jones
d27ae8694e fix(logger): logger levels now shared across instances of same category 2017-04-28 08:29:14 +10:00
Gareth Jones
dd208520d8 fix(logFaces): split logfaces into UDP+HTTP, added context to loggers 2017-03-15 10:01:13 +11:00
Gareth Jones
4333261721 fix(levels): added level configuration, fixed smtp appender 2017-03-09 08:28:41 +11:00
Gareth Jones
1d50b82a96 refactor: fixed a few more appenders 2017-02-07 08:53:51 +11:00
Gareth Jones
5283782ba0 refactor(all): basic logging to stdout works again
- removed config reloading
- removed console replacement
- added recording appender
- added config validation
- changed config format
2017-02-05 10:05:49 +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