Compare commits

...

2 commits

Author SHA1 Message Date
d55d81f0a3
prepare release v0.3.2 2024-03-24 13:56:36 +01:00
46dbb7049c
Fix: Move database logging to stderr
to prevent parsing errors to break the bot response

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-03-24 13:56:08 +01:00
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,7 @@
# 0.3.2 / 2024-03-24
* Fix: Move database logging to stderr
# 0.3.1 / 2024-03-24
* Fix: Reduce storage size also for status

View file

@ -2,12 +2,16 @@ package database
import (
"fmt"
"log"
"os"
"time"
"github.com/glebarez/sqlite"
"github.com/pkg/errors"
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
)
type (
@ -36,6 +40,12 @@ func New(driverName, connString string) (d *DB, err error) {
db, err := gorm.Open(innerDB, &gorm.Config{
DisableForeignKeyConstraintWhenMigrating: true,
Logger: logger.New(log.New(os.Stderr, "\r\n", log.LstdFlags), logger.Config{
SlowThreshold: time.Second,
LogLevel: logger.Warn,
IgnoreRecordNotFoundError: true,
Colorful: false,
}),
})
if err != nil {
return nil, errors.Wrap(err, "connecting database")