Integrate GORM Logger with Zerolog and Add Configuration Options for Logging and Performance (#2040)

* Integrate GORM logger with zerolog and add custom GORM configuration options

* Add GormConfig struct to group GORM-related settings

* Update debug mode instruction in config-example.yaml

Co-authored-by: Kristoffer Dalby <kristoffer@dalby.cc>

---------

Co-authored-by: Kristoffer Dalby <kristoffer@dalby.cc>
This commit is contained in:
nadongjun 2024-08-19 18:47:52 +09:00 committed by GitHub
parent ac8491efec
commit fdc034e8ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 118 additions and 2 deletions

View file

@ -140,6 +140,23 @@ ephemeral_node_inactivity_timeout: 30m
database:
type: sqlite
# Enable debug mode. This setting requires the log.level to be set to "debug" or "trace".
debug: false
# GORM configuration settings.
gorm:
# Enable prepared statements.
prepare_stmt: true
# Enable parameterized queries.
parameterized_queries: true
# Skip logging "record not found" errors.
skip_err_record_not_found: true
# Threshold for slow queries in milliseconds.
slow_threshold: 1000
# SQLite config
sqlite:
path: /var/lib/headscale/db.sqlite