Skip to content

Commit

Permalink
0: xml logger should expand return properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlokok committed Apr 18, 2012
1 parent eb5379e commit d49f019
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion RemObjects.Train/API/Logging.pas
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ interface
method LogInfo(s: String); locked;
method Enter(aImportant: Boolean := false; aScript: String; params args: array of Object);locked;
method &Exit(aImportant: Boolean := false; aScript: String; aFailMode: FailMode; aResult: Object);locked;
class method MyToString(s: Object): String;
end;


Expand Down Expand Up @@ -201,7 +202,7 @@ constructor XmlLogger(aTargetXML, aTargetHTML, aXSLT: String);
else '0';
end));
if (aResult <> nil) and (aResult <> Undefined.Instance) then
fXmlData.Add(new XElement('return', aResult:ToString));
fXmlData.Add(new XElement('return', Filter(MyToString(aResult))));
fXmlData := fXmlData.Parent;
end;

Expand Down Expand Up @@ -258,6 +259,16 @@ constructor BaseXmlLogger;
FindFailNodes(var lFailElement, fXmlData.Document.Root.Elements);
end;

class method BaseXmlLogger.MyToString(s: Object): String;
begin
if s = nil then exit '';
if s is array of Object then
exit String.Join(', ', array of Object(s).Select(a->MyToString(a)).ToArray);
if s is EcmaScriptObject then
exit coalesce(EcmaScriptObject(s).Root.JSONStringify(EcmaScriptObject(s).Root.ExecutionContext, nil, s):ToString, '');
exit s.ToString;
end;

constructor MultiLogger;
begin

Expand Down
4 changes: 2 additions & 2 deletions RemObjects.Train/API/MSBuild.pas
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ implementation
end;
end ,a-> begin
if not String.IsNullOrEmpty(a) then begin
if a.StartsWith('MSBUILD : error') then
if a.Contains(': error ') then
lTmp.LogError(a);
locking lOutput do lOutput.AppendLine(a);
end;
Expand Down Expand Up @@ -236,7 +236,7 @@ implementation
end;
end ,a-> begin
if not String.IsNullOrEmpty(a) then begin
if a.StartsWith('MSBUILD : error') then
if a.Contains(': error ') then
lTmp.LogError(a);
locking lOutput do lOutput.AppendLine(a);
end;
Expand Down
2 changes: 1 addition & 1 deletion RemObjects.Train/API/Wrapper.pas
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ constructor Wrapper(aServices: IApiRegistrationServices; aMethod: System.Reflect
end;
finally
if not String.IsNullOrEmpty(fWrapInfo.LogName) then
fServices.Logger.Exit(fWrapInfo.Important, fWrapInfo.LogName, if lFail then RemObjects.Train.FailMode.Yes else RemObjects.Train.FailMode.No, aArgs );
fServices.Logger.Exit(fWrapInfo.Important, fWrapInfo.LogName, if lFail then RemObjects.Train.FailMode.Yes else RemObjects.Train.FailMode.No, result);
end;
end;

Expand Down

0 comments on commit d49f019

Please sign in to comment.