Simplified the log level name <--> number lookup in a few places.

Just a few refactorings more, and all functions will be one-liners... :smiley: 
Fixed.

I've rebased the branch from master, so PR is now updated.