From 3ea1d30e62ef4ab2f7b16e5e34c921156cc5b661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E5=A3=AB=E6=9D=B0?= <123645649+notutensil@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:34:54 +0800 Subject: [PATCH] Masking the output of sensitive information in logs. --- gorm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gorm.go b/gorm.go index 775cd3de3..ddc55c613 100644 --- a/gorm.go +++ b/gorm.go @@ -325,6 +325,14 @@ func (db *DB) Debug() (tx *DB) { }) } +// Silent start silent mode +func (db *DB) Silent() (tx *DB) { + tx = db.getInstance() + return tx.Session(&Session{ + Logger: db.Logger.LogMode(logger.Silent), + }) +} + // Set store value with key into current db instance's context func (db *DB) Set(key string, value interface{}) *DB { tx := db.getInstance()