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:
Abhimanyu Yadav
2024-01-15 19:32:41 +05:30
committed by GitHub
parent 1dcee2b338
commit ff4ff869ab
2 changed files with 13 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@trigger.dev/sdk": patch
---
You can pass an Error() instead of properties to all of the `io.logger` functions
+8
View File
@@ -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],