Logging
Hysteria ORM provides built-in logging for queries and errors that node console.log under the hood. Logging is synchronous by default, so it's recommended to use only in development and not in production since it can impact performance.
Enabling Logs
- Set
DB_LOGS=true
in your environment, or passlogs: true
in connection options.
Custom Logger
You can provide your own logger with the following interface:
import { logger } from 'hysteria-orm';
logger.setCustomLogger({
info: (msg) => {/* ... */},
warn: (msg) => {/* ... */},
error: (msg) => {/* ... */},
});
Log Output
- Logs include timestamps and color coding for info, warn, and error.
Next: SQL Introduction