implement log sorter