Add logdir param

Expects config to be a global variable provided elsewhere.