Fix some cppcheck warnings
Added simple logging framework