Browse Source

Fixes single-line logging

main
Eric Amodio 2 years ago
parent
commit
989297397f
1 changed files with 19 additions and 10 deletions
  1. +19
    -10
      src/system/decorators/log.ts

+ 19
- 10
src/system/decorators/log.ts View File

@ -188,7 +188,7 @@ export function log any>(options?: LogOptions, deb
logFn(`${prefix}${enter}`);
}
} else {
let loggableParams = '';
loggableParams = '';
let paramOverride;
let paramIndex = -1;
@ -226,8 +226,11 @@ export function log any>(options?: LogOptions, deb
if (!singleLine) {
logFn(
`${prefix}${enter}`,
!debug && !Logger.enabled(LogLevel.Debug) && !Logger.isDebugging ? emptyStr : loggableParams,
`${prefix}${enter}${
loggableParams && (debug || Logger.enabled(LogLevel.Debug) || Logger.isDebugging)
? `(${loggableParams})`
: emptyStr
}`,
);
}
}
@ -240,9 +243,8 @@ export function log any>(options?: LogOptions, deb
if (singleLine) {
Logger.error(
ex,
`${prefix}${enter}`,
`${prefix}${enter}${loggableParams ? `(${loggableParams})` : emptyStr}`,
`failed${scope?.exitDetails ? scope.exitDetails : emptyStr}${timing}`,
loggableParams,
);
} else {
Logger.error(ex, prefix, `failed${scope?.exitDetails ? scope.exitDetails : emptyStr}${timing}`);
@ -291,13 +293,20 @@ export function log any>(options?: LogOptions, deb
if (singleLine) {
exitLogFn(
`${prefix}${enter} ${exit}${scope?.exitDetails ? scope.exitDetails : emptyStr}${timing}`,
!debug && !Logger.enabled(LogLevel.Debug) && !Logger.isDebugging
? emptyStr
: loggableParams,
`${prefix}${enter}${
loggableParams && (debug || Logger.enabled(LogLevel.Debug) || Logger.isDebugging)
? `(${loggableParams})`
: emptyStr
} ${exit}${scope?.exitDetails ? scope.exitDetails : emptyStr}${timing}`,
);
} else {
exitLogFn(`${prefix} ${exit}${scope?.exitDetails ? scope.exitDetails : emptyStr}${timing}`);
exitLogFn(
`${prefix}${
loggableParams && (debug || Logger.enabled(LogLevel.Debug) || Logger.isDebugging)
? `(${loggableParams})`
: emptyStr
} ${exit}${scope?.exitDetails ? scope.exitDetails : emptyStr}${timing}`,
);
}
if (scoped) {

Loading…
Cancel
Save