| 302 | } |
| 303 | |
| 304 | func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { |
| 305 | if len(msgAndArgs) == 0 || msgAndArgs == nil { |
| 306 | return "" |
| 307 | } |
| 308 | if len(msgAndArgs) == 1 { |
| 309 | msg := msgAndArgs[0] |
| 310 | if msgAsStr, ok := msg.(string); ok { |
| 311 | return msgAsStr |
| 312 | } |
| 313 | return fmt.Sprintf("%+v", msg) |
| 314 | } |
| 315 | if len(msgAndArgs) > 1 { |
| 316 | return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) |
| 317 | } |
| 318 | return "" |
| 319 | } |
| 320 | |
| 321 | // Aligns the provided message so that all lines after the first line start at the same location as the first line. |
| 322 | // Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). |