3 ms·
Perhaps it depends on how much content you're putting into the message, normally? Eg, big multi-line strings, followed by more args at the end, is not a syntax
by fizzbatter 12y ago
Perhaps it depends on how much content you're putting into the message, normally? Eg, big multi-line strings, followed by more args at the end, is not a syntax i personally prefer.
With that said, i really do wish Go supported `DebugWithTags(tags ...string, message string)` syntax. I've had so many cases where i wanted to use something similar.
- kornish 12y agoFor the record, if the last argument of a Golang function is variadic, you can still pass an array to it - you just have to transform the array into variadic args by appending `...` to it. So adopting the type signature above could give you the best of both worlds - the ability to use one-off tag combinations inline, but also the ability to pass predefined arrays of tags.
- fizzbatter 12y agoI hadn't actually seen their Code, it looks like they actually use `DebugWithTags([]string, string, ...interface{})`. So the `...interface{}` is the blocker here, as it appears in every logger that they have. Though, i would agree that the order should be switched. Eg, `DebugWithTags(string, []string, ...interface{})`