pjvds / tidy

Go lang structured logging made fast and simple
7 stars 0 forks source link

Module should reflect package path #7

Closed pjvds closed 9 years ago

pjvds commented 9 years ago

Currently a module type is defined as a string:

type Module string

This means it only reflects the package name, and doesn't store the package path. As an example:

// package github.com/foo/bar/baz
module := tidy.GetModuleFromCaller(0)
print(module)

The code above will print:

baz

This is great when the name is included in an formatter, like the ColoredTextFormatter. Yet, when configuring the log output per module it is more flexible to have the full path available like glog does. This allows us to add features like setting the log level for a certain path, like:

LOG='github.com/pjvds/tidy/*:DEBUG' myapp

It also allows to set the level even if package names (last part of a package path) collides.

pjvds commented 9 years ago

This is fixed now, the Module type now holds a path and a name.