Add support for logging severity

please review @r0mant @jeremyschlatter @anton-efimenko 
Why trim space? If the implementation adds a ton of extra newlines for some reason, this test won't catch it.