Whenever it shall be necessary to adjust costs in any interlocutory proceeding in an action or in any special proceedings, they shall be adjusted by the judge before whom the proceeding may be heard or the court before which the proceeding may be decided or pending or in such other manner as the judge or court may direct.