@spfn/core 0.1.0-alpha.30 → 0.1.0-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/db/index.js CHANGED
@@ -1799,26 +1799,34 @@ var Repository = class {
1799
1799
  const result = await fn();
1800
1800
  const duration = performance.now() - startTime;
1801
1801
  if (duration >= config.slowThreshold) {
1802
- const dbLogger4 = logger.child("database");
1803
- const logData = {
1804
- operation,
1805
- table: this.table._.name,
1806
- duration: `${duration.toFixed(2)}ms`,
1807
- threshold: `${config.slowThreshold}ms`
1808
- };
1809
- dbLogger4.warn("Slow query detected", logData);
1802
+ try {
1803
+ const dbLogger4 = logger.child("database");
1804
+ const logData = {
1805
+ operation,
1806
+ table: this.table[Symbol.for("drizzle:Name")],
1807
+ duration: `${duration.toFixed(2)}ms`,
1808
+ threshold: `${config.slowThreshold}ms`
1809
+ };
1810
+ dbLogger4.warn("Slow query detected", logData);
1811
+ } catch (logError) {
1812
+ console.error("Failed to log slow query:", logError);
1813
+ }
1810
1814
  }
1811
1815
  return result;
1812
1816
  } catch (error) {
1813
1817
  const duration = performance.now() - startTime;
1814
- const dbLogger4 = logger.child("database");
1815
- const message = error instanceof Error ? error.message : "Unknown error";
1816
- dbLogger4.error("Query failed", {
1817
- operation,
1818
- table: this.table._.name,
1819
- duration: `${duration.toFixed(2)}ms`,
1820
- error: message
1821
- });
1818
+ try {
1819
+ const dbLogger4 = logger.child("database");
1820
+ const message = error instanceof Error ? error.message : "Unknown error";
1821
+ dbLogger4.error("Query failed", {
1822
+ operation,
1823
+ table: this.table[Symbol.for("drizzle:Name")],
1824
+ duration: `${duration.toFixed(2)}ms`,
1825
+ error: message
1826
+ });
1827
+ } catch (logError) {
1828
+ console.error("Failed to log query error:", logError);
1829
+ }
1822
1830
  throw error;
1823
1831
  }
1824
1832
  }