(userId int, logType int, content string)
| 76 | } |
| 77 | |
| 78 | func RecordLog(userId int, logType int, content string) { |
| 79 | if logType == LogTypeConsume && !common.LogConsumeEnabled { |
| 80 | return |
| 81 | } |
| 82 | username, _ := GetUsernameById(userId, false) |
| 83 | log := &Log{ |
| 84 | UserId: userId, |
| 85 | Username: username, |
| 86 | CreatedAt: common.GetTimestamp(), |
| 87 | Type: logType, |
| 88 | Content: content, |
| 89 | } |
| 90 | err := LOG_DB.Create(log).Error |
| 91 | if err != nil { |
| 92 | common.SysError("failed to record log: " + err.Error()) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | func RecordErrorLog(c *gin.Context, userId int, channelId int, modelName string, tokenName string, content string, tokenId int, useTimeSeconds int, |
| 97 | isStream bool, group string, other map[string]interface{}) { |
no test coverage detected