Split logging into own module

I have no clue why self is undefined...