added conditional logging with level system