Skip to content

Commit

Permalink
fix(orm): add resource type in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Jul 3, 2024
1 parent 9d6e19f commit 490a5a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions orm/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Resource<T extends model> {
try {
if (typeof id === "string") {
this.data.id = id
this.#log = (this.constructor as typeof Resource).log?.with({ id: this.id }) ?? null
this.#log = (this.constructor as typeof Resource).log?.with({ type: this.constructor.name, id: this.id }) ?? null
this.log?.with({ op: "fetch" }).debug("fetching")
await this.#dispatch("fetch")
const { value, version } = await this.store.get<T>(this.keys[0])
Expand All @@ -143,7 +143,7 @@ export class Resource<T extends model> {
this.log?.with({ op: "fetch" }).debug("fetched")
} else {
Object.assign(this.data, { id: ulid(), ...id })
this.#log = (this.constructor as typeof Resource).log?.with({ id: this.id }) ?? null
this.#log = (this.constructor as typeof Resource).log?.with({ type: this.constructor.name, id: this.id }) ?? null
await this.#dispatch("created")
this.log?.with({ op: "created" }).debug("created")
}
Expand Down

0 comments on commit 490a5a5

Please sign in to comment.