Skip to content

Commit

Permalink
return debug logs as json via url param (#1125)
Browse files Browse the repository at this point in the history
* support returning list of debug logs as json

append format=json to url

* allow returning debug log as json

append format=json to url

* Apply suggestions from code review

Co-authored-by: John Bampton <jbampton@users.noreply.github.com>

Co-authored-by: John Bampton <jbampton@users.noreply.github.com>
  • Loading branch information
zspitzer and jbampton authored Apr 1, 2021
1 parent b75a2a3 commit 8116b65
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
24 changes: 15 additions & 9 deletions core/src/main/cfml/context/admin/debugging.logs.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,19 @@ Redirtect to entry --->

<cfreturn (time/1000000)&" ms">
</cffunction>


<cfscript>
param name="url.action2" default="list";
param name="url.format" default="";
<cfparam name="url.action2" default="list">

<cfif url.action2 EQ "list">
<cfinclude template="debugging.logs.list.cfm">
<cfelse>
<cfinclude template="debugging.logs.detail.cfm">
</cfif>
if (url.action2 EQ "list") {
if (url.format eq "json") {
setting showdebugoutput="false";
content reset="yes" type="application/json";
echo(serializeJson(logs));
abort;
}
include template="debugging.logs.list.cfm";
} else {
include template="debugging.logs.detail.cfm";
}
</cfscript>
7 changes: 7 additions & 0 deletions core/src/main/cfml/context/admin/debugging.logs.detail.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
log=el;
}
}
if (url.format eq "json") {
setting showdebugoutput="false";
content reset="yes" type="application/json";
echo(serializeJson(log));
abort;
}
</cfscript>
<cfoutput>
<cfif !isSimpleValue(log) && structCount(drivers)>
Expand Down

0 comments on commit 8116b65

Please sign in to comment.