print log information or save into file