using logging module / separated thresholding to a function