Logging system almost done, some fix and tests are still missing though