使用日志
使用日志
引用日志单元:
uses core.log;
使用方法,请看代码中的注释:
procedure TDanWei.Select(AContext: TContext); var LDB: TDB; LPool: TDBPool; LRequest, LResponse: TJsonO; begin LRequest := SO(AContext.InContent); if LRequest = nil then Exit; LResponse := TJsonO.Create; try try LPool := GetDBPool(LRequest.S[TConst.DBId]); LDB := LPool.Lock; LDB.Select('select * from tunit'); LResponse.B[TConst.Success] := True; LResponse.S[TConst.Msg] := '查询成功'; LResponse.A[TConst.Fields] := LDB.qry.FieldsToJsonArray; LResponse.A[TConst.Data] := LDB.qry.DataToJsonArray; AContext.Send(LResponse); except on E: Exception do begin LResponse.B[TConst.Success] := False; LResponse.S[TConst.Msg] := E.Message; AContext.Send(LResponse); WriteLog('TDanWei.Select()' + E.Message);//写异常日志 end; end; finally LPool.Unlock(LDB); LResponse.Free; LRequest.Free; end; end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/18853413