| | |
| | | go saveLoop() |
| | | } |
| | | |
| | | func Save(level int, logType int,template string, v ...interface{}) { |
| | | cache(level, logType, "", "", template, v) |
| | | func Save(level int, logType int, v ...interface{}) { |
| | | cache(level, logType, "", "", v) |
| | | } |
| | | |
| | | func SaveManual(level int, logType int, userID string, userName string, template string, v ...interface{}) { |
| | | cache(level, logType, userID, userName, template, v) |
| | | func SaveManual(level int, logType int, userID string, userName string, v ...interface{}) { |
| | | cache(level, logType, userID, userName, v) |
| | | } |
| | | |
| | | func cache(level int, logType int, userID string, userName string, template string, fmtArgs []interface{}) { |
| | | func cache(level int, logType int, userID string, userName string, fmtArgs []interface{}) { |
| | | // Format with Sprint, Sprintf, or neither. |
| | | msg := template |
| | | if msg == "" && len(fmtArgs) > 0 { |
| | | msg := "" |
| | | if len(fmtArgs) > 0 { |
| | | msg = fmt.Sprint(fmtArgs...) |
| | | } else if msg != "" && len(fmtArgs) > 0 { |
| | | msg = fmt.Sprintf(template, fmtArgs...) |
| | | } |
| | | fmt.Println(msg) |
| | | |
| | | log := LogInfo { |
| | | ID: uuid.NewV4().String(), |