object specifying the target and method(s) to embellish with logging.
the method name or RegExp to match methods for logging.
the object, class instance, or class constructor whose methods will be wrapped.
Optional
config: AutoLogConfigconfiguration settings
Configuration options for the autologging feature. These options are optional and can be passed to the autolog() function to customize the logging behavior.
Optional
logger?: LoggerName of logger to use for autologging, defaults to 'default'
Optional
logLevel?: numberThe logging level autologging uses - defaults to 'debug'
Optional
withArgs?: booleanset true to include automatically include passed method arguments in the logs
Optional
withGovernance?: booleanIf true, includes governance before and after function execution
Optional
withProfiling?: booleanIf true, including function (execution time) statistics
Optional
withReturnValue?: booleanIf true, includes the function return value in the log
an array of advices applied to the matched methods
namespace X {
export onRequest() {
log.debug('hello world')
}
}
LogManager.autoLogMethodEntryExit({ target:X, method:/\w+/})
The above results in automatic log entries similar to:
Log Title | Detail |
---|---|
Enter onRequest() | args:[] |
hello world | |
Exit onRequest() | returned: undefined |
log all methods in a class
class MyService {
doSomething(a, b) {
log.debug('doing something');
return a + b;
}
}
const service = new MyService();
autoLogMethodEntryExit({ target: service, method: /\w+/ });
service.doSomething(1, 2);
Results in log entries for each method call, similar to:
|Log Title | Detail |
|--------|--------|
|Enter doSomething()| args:[1,2] |
|doing something | |
|Exit doSomething() | returned: 3 |
Automatically log method entry/exit with arguments to the netsuite execution log. Call this method at the end of your script. Log entries are 'DEBUG' level by default but may be overridden as described below.
You can pass either an object, a class instance, or a class constructor as the target. All matching methods (by name or RegExp) will be wrapped for automatic logging.