Add log level support

Please check if all log levels are appropriate and if my env-reading
stuff can be optimized.
Same thing here.