Skip to content

Commit a73769e

Browse files
committed
get current profiler
1 parent 16f83bb commit a73769e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

handlers/Main.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ component extends="coldbox.system.RestHandler" {
6666
debuggerService : variables.debuggerService,
6767
environment : variables.debuggerService.getEnvironment(),
6868
profilers : variables.debuggerService.getProfilerStorage(),
69-
currentProfiler : variables.debuggerService.getProfilerStorage()[ 1 ] ?: {},
69+
currentProfiler : variables.debuggerService.getCurrentProfiler(),
7070
manifestRoot : event.getModuleRoot( "cbDebugger" ) & "/includes"
7171
}
7272
);

models/DebuggerService.cfc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,21 @@ component
246246
return this;
247247
}
248248

249+
/**
250+
* Get the current profiler for the current request. Basically the first in the stack
251+
*
252+
* @return The current request profiler or an empty struct if none found.
253+
*/
254+
struct function getCurrentProfiler(){
255+
var profilers = getProfilerStorage();
256+
257+
if( arrayLen( profilers ) ){
258+
return profilers[ 1 ];
259+
}
260+
261+
return {};
262+
}
263+
249264
/**
250265
* Get the profiler storage array depending on the storage options
251266
*/

0 commit comments

Comments
 (0)