News for hackers. Stuff that matters.
Re:Tagged Logging in Go by jzelinskie on Thursday February 12, 2015 @11:50AM (#9039727)
Wouldn't the signature of the tagged logging function be better if it was something like:

     DebugWithTags(message string, tags ...string)
This way you could easily add tags without having to explicitly allocate a []string whenever you wanted to change them.
Re:Tagged Logging in Go by fizzbatter on Thursday February 12, 2015 @02:41PM (#9040890)
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.

Re:Tagged Logging in Go by kornish on Thursday February 12, 2015 @02:56PM (#9040987)
For 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.
Re:Tagged Logging in Go by fizzbatter on Thursday February 12, 2015 @03:00PM (#9041010)
I 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{})`

Re:Tagged Logging in Go by blakecaldwell on Thursday February 12, 2015 @04:56PM (#9041629)
It's more consistent with the printf-style counterparts:

  func (logger *LoggerImpl) DebugWithTagsf(tags []string, fmt string, args ...interface{}) {
  	logger.logwithformat(DEBUG, tags, fmt, args...)
  }
Re:Tagged Logging in Go by mmf on Thursday February 12, 2015 @05:03PM (#9041665)
I think that function is meant to set the debug level, not to produce a log output...
Re:Tagged Logging in Go by pythonist on Thursday February 12, 2015 @01:13PM (#9040240)
+1 :)