#233: Adding ability to put pid in log layout pattern
This commit is contained in:
@@ -125,6 +125,7 @@ function messagePassThroughLayout (loggingEvent) {
|
||||
* - %d date in various formats
|
||||
* - %% %
|
||||
* - %n newline
|
||||
* - %z pid
|
||||
* - %x{<tokenname>} add dynamic tokens to your log. Tokens are specified in the tokens parameter
|
||||
* You can use %[ and %] to define a colored block.
|
||||
*
|
||||
@@ -211,6 +212,10 @@ function patternLayout (pattern, tokens) {
|
||||
return '%';
|
||||
}
|
||||
|
||||
function pid() {
|
||||
return process.pid;
|
||||
}
|
||||
|
||||
function userDefined(loggingEvent, specifier) {
|
||||
if (typeof(tokens[specifier]) !== 'undefined') {
|
||||
if (typeof(tokens[specifier]) === 'function') {
|
||||
@@ -232,6 +237,7 @@ function patternLayout (pattern, tokens) {
|
||||
'r': startTime,
|
||||
'[': startColour,
|
||||
']': endColour,
|
||||
'z': pid,
|
||||
'%': percent,
|
||||
'x': userDefined
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user