More accurate input reading

1) Add logger class for printing warns and errors
2) Log errors while reading
3) Use EXIT_FAILURE and EXIT_SUCCESS as return codes