Refactor/logger

extract all functions related to logfile into it's own module.