-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add async log and update gorm tracing (#149)
* feat: add async log and update grom tracing * chore: fix typo
- Loading branch information
Showing
10 changed files
with
87 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
default: | ||
Driver: mysql # 驱动名称,目前支持 mysql,postgres,默认: mysql | ||
Name: eagle # 数据库名称 | ||
Addr: db:3306 # 如果是 docker,可以替换为 对应的服务名称,eg: db:3306 | ||
Driver: mysql # 驱动名称,目前支持 mysql,postgres,默认: mysql | ||
Name: eagle # 数据库名称 | ||
Addr: db:3306 # 如果是 docker,可以替换为 对应的服务名称,eg: db:3306 | ||
UserName: root | ||
Password: root | ||
ShowLog: true # 是否打印所有SQL日志 | ||
MaxIdleConn: 10 # 最大闲置的连接数,0意味着使用默认的大小2, 小于0表示不使用连接池 | ||
MaxOpenConn: 60 # 最大打开的连接数, 需要小于数据库配置中的max_connections数 | ||
Timeout: 3s # 数据库连接超时时间 | ||
ReadTimeout: 3s # 数据库去读超时时间, 0代表不限制 | ||
WriteTimeout: 3s # 数据库写入超时时间, 0代表不限制 | ||
ConnMaxLifeTime: 4h # 单个连接最大存活时间,建议设置比数据库超时时长(wait_timeout)稍小一些 | ||
SlowThreshold: 500ms # 慢查询阈值,设置后只打印慢查询日志,默认为200ms | ||
ShowLog: true # 是否打印所有SQL日志 | ||
MaxIdleConn: 10 # 最大闲置的连接数,0意味着使用默认的大小2, 小于0表示不使用连接池 | ||
MaxOpenConn: 60 # 最大打开的连接数, 需要小于数据库配置中的max_connections数 | ||
Timeout: 3s # 数据库连接超时时间 | ||
ReadTimeout: 3s # 数据库去读超时时间, 0代表不限制 | ||
WriteTimeout: 3s # 数据库写入超时时间, 0代表不限制 | ||
ConnMaxLifeTime: 4h # 单个连接最大存活时间,建议设置比数据库超时时长(wait_timeout)稍小一些 | ||
SlowThreshold: 500ms # 慢查询阈值,设置后只打印慢查询日志,默认为200ms | ||
EnableTrace: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ LogRollingPolicy: daily | |
LogRotateDate: 1 | ||
LogRotateSize: 1 | ||
LogBackupCount: 7 | ||
FlushInterval: 1s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
default: | ||
Driver: mysql # 驱动名称,目前支持: mysql,postgres,默认: mysql | ||
Name: eagle # 数据库名称 | ||
Addr: localhost:3306 # 如果是 docker,可以替换为 对应的服务名称,eg: db:3306, pg:5432 | ||
Driver: mysql # 驱动名称,目前支持: mysql,postgres,默认: mysql | ||
Name: eagle # 数据库名称 | ||
Addr: localhost:3306 # 如果是 docker,可以替换为 对应的服务名称,eg: db:3306, pg:5432 | ||
UserName: root | ||
Password: 123456 | ||
ShowLog: true # 是否打印所有SQL日志 | ||
MaxIdleConn: 10 # 最大闲置的连接数,0意味着使用默认的大小2, 小于0表示不使用连接池 | ||
MaxOpenConn: 60 # 最大打开的连接数, 需要小于数据库配置中的max_connections数 | ||
Timeout: 3s # 数据库连接超时时间, 如果是 PostgreSQL 不需要加入单位 | ||
ReadTimeout: 3s # 数据库去读超时时间, 0代表不限制,如果是PostgreSQL, 3000代表3s | ||
WriteTimeout: 3s # 数据库写入超时时间, 0代表不限制,如果是PostgreSQL, 不会使用该字段的值 | ||
ConnMaxLifeTime: 4h # 单个连接最大存活时间,建议设置比数据库超时时长(wait_timeout)稍小一些 | ||
SlowThreshold: 500ms # 慢查询阈值,设置后只打印慢查询日志,默认为200ms | ||
ShowLog: true # 是否打印所有SQL日志 | ||
MaxIdleConn: 10 # 最大闲置的连接数,0意味着使用默认的大小2, 小于0表示不使用连接池 | ||
MaxOpenConn: 60 # 最大打开的连接数, 需要小于数据库配置中的max_connections数 | ||
Timeout: 3s # 数据库连接超时时间, 如果是 PostgreSQL 不需要加入单位 | ||
ReadTimeout: 3s # 数据库去读超时时间, 0代表不限制,如果是PostgreSQL, 3000代表3s | ||
WriteTimeout: 3s # 数据库写入超时时间, 0代表不限制,如果是PostgreSQL, 不会使用该字段的值 | ||
ConnMaxLifeTime: 4h # 单个连接最大存活时间,建议设置比数据库超时时长(wait_timeout)稍小一些 | ||
SlowThreshold: 500ms # 慢查询阈值,设置后只打印慢查询日志,默认为200ms | ||
EnableTrace: false | ||
user: | ||
Driver: mysql # 驱动名称,目前支持: mysql,postgres,默认: mysql | ||
Name: eagle # 数据库名称 | ||
Addr: localhost:3306 # 如果是 docker,可以替换为 对应的服务名称,eg: db:3306, pg:5432 | ||
Driver: mysql # 驱动名称,目前支持: mysql,postgres,默认: mysql | ||
Name: eagle # 数据库名称 | ||
Addr: localhost:3306 # 如果是 docker,可以替换为 对应的服务名称,eg: db:3306, pg:5432 | ||
UserName: root | ||
Password: 123456 | ||
ShowLog: true # 是否打印所有SQL日志 | ||
MaxIdleConn: 10 # 最大闲置的连接数,0意味着使用默认的大小2, 小于0表示不使用连接池 | ||
MaxOpenConn: 60 # 最大打开的连接数, 需要小于数据库配置中的max_connections数 | ||
Timeout: 3s # 数据库连接超时时间 | ||
ReadTimeout: 3s # 数据库去读超时时间, 0代表不限制 | ||
WriteTimeout: 3s # 数据库写入超时时间, 0代表不限制 | ||
ConnMaxLifeTime: 4h # 单个连接最大存活时间,建议设置比数据库超时时长(wait_timeout)稍小一些 | ||
SlowThreshold: 500ms # 慢查询阈值,设置后只打印慢查询日志,默认为200ms | ||
ShowLog: true # 是否打印所有SQL日志 | ||
MaxIdleConn: 10 # 最大闲置的连接数,0意味着使用默认的大小2, 小于0表示不使用连接池 | ||
MaxOpenConn: 60 # 最大打开的连接数, 需要小于数据库配置中的max_connections数 | ||
Timeout: 3s # 数据库连接超时时间 | ||
ReadTimeout: 3s # 数据库去读超时时间, 0代表不限制 | ||
WriteTimeout: 3s # 数据库写入超时时间, 0代表不限制 | ||
ConnMaxLifeTime: 4h # 单个连接最大存活时间,建议设置比数据库超时时长(wait_timeout)稍小一些 | ||
SlowThreshold: 500ms # 慢查询阈值,设置后只打印慢查询日志,默认为200ms | ||
EnableTrace: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ LogRollingPolicy: daily | |
LogRotateDate: 1 | ||
LogRotateSize: 1 | ||
LogBackupCount: 7 | ||
FlushInterval: 1s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters