| 282 | } |
| 283 | |
| 284 | func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { |
| 285 | if len(msgAndArgs) == 0 || msgAndArgs == nil { |
| 286 | return "" |
| 287 | } |
| 288 | if len(msgAndArgs) == 1 { |
| 289 | msg := msgAndArgs[0] |
| 290 | if msgAsStr, ok := msg.(string); ok { |
| 291 | return msgAsStr |
| 292 | } |
| 293 | return fmt.Sprintf("%+v", msg) |
| 294 | } |
| 295 | if len(msgAndArgs) > 1 { |
| 296 | return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) |
| 297 | } |
| 298 | return "" |
| 299 | } |
| 300 | |
| 301 | // Aligns the provided message so that all lines after the first line start at the same location as the first line. |
| 302 | // Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). |