add type checking to alert api
make sure log dir exists before using it
add type checking to assert.element api