added global function for logging