feat(logger): accepting Error objects as parameters in io.logger.error() (#797)
* feat(logger): accepting Error objects as parameters in io.logger.error() * Allow errors for any log level * Create silent-ties-vanish.md --------- Co-authored-by: Matt Aitken <matt@mattaitken.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
---
|
||||
|
||||
You can pass an Error() instead of properties to all of the `io.logger` functions
|
||||
@@ -214,6 +214,14 @@ export class IO {
|
||||
return new IOLogger(async (level, message, data) => {
|
||||
let logLevel: LogLevel = "info";
|
||||
|
||||
if(data instanceof Error){
|
||||
data = {
|
||||
name : data.name,
|
||||
message : data.message,
|
||||
stack : data.stack
|
||||
}
|
||||
}
|
||||
|
||||
if (Logger.satisfiesLogLevel(logLevel, this._jobLogLevel)) {
|
||||
await this.runTask(
|
||||
[message, level],
|
||||
|
||||
Reference in New Issue
Block a user