us.wdg.cf.firelogger
Component firelogger (CF-FireLogger)

This component handles server-side output for the FireLogger (http://firelogger.binaryage.com) Firebug plugin.

hierarchy: WEB-INF.cftags.component
      Firelogger.us.wdg.cf.firelogger
path: \us\wdg\cf\firelogger.cfc
serializable: Yes
properties: debugLevel, debugMode, debugTraceInline, fallbackLogMethod, filename, isConsoleEnabled, lineno, loggerBGColor, loggerFGColor, loggerName, maxEncodeDepth, maxHeaderLength, obj, password, text, type, valuesAlreadySerialized, version
methods: buildHeaders*, clientVersionCheck*, critical, doLog*, encodeJSON, err, error, fireloggerPasswordCheck*, formatErrorOutput, getCallerFileLine*, GETDEBUGLEVEL, GETDEBUGMODE, GETDEBUGTRACEINLINE, GETFALLBACKLOGMETHOD, GETISCONSOLEENABLED, GETLOGGERBGCOLOR, GETLOGGERFGCOLOR, GETLOGGERNAME, GETOBJ, getParameters*, GETTEXT, GETTYPE, GETVERSION, info, init, log, logProxy*, panic*, resetLoggerBadge, sendHeaders*, SETDEBUGLEVEL, SETDEBUGMODE, SETDEBUGTRACEINLINE, SETFALLBACKLOGMETHOD, SETFILENAME, setIsConsoleEnabled*, SETLINENO, SETLOGGERBGCOLOR, SETLOGGERFGCOLOR, SETLOGGERNAME, SETMAXENCODEDEPTH, SETMAXHEADERLENGTH, SETOBJ, setParameters*, setPassword, SETTEXT, SETTYPE, SETVALUESALREADYSERIALIZED, splitStrToArray*, typeFL2CF*, warn

* - private method

Property Hint Type Req. Implemented In Default Value Serializable
debugLevel One of: panic : show only erros that can't be sent via headers; error : dump all errors; info: show debug info. string   firelogger panic Yes
debugMode Set to true to enable CF FireLogger debugging. boolean   firelogger false Yes
debugTraceInline Set to true to trace debug info to current page, false to trace to debug info/log file. boolean   firelogger true Yes
fallbackLogMethod How to handle logging if FireLogger is unable to. One of: trace-inline, trace, dump, none. string   firelogger trace-inline Yes
filename Path/name of file containig log() directive. Typically set by this component, but this setting can override it. string   firelogger   Yes
isConsoleEnabled Is true if Firebug/FireLogger console is enabled (read-only). boolean   firelogger false Yes
lineno Line number log call was made from. Typically set by this component, but this setting can override it. string   firelogger ? Yes
loggerBGColor Background color for badge/label, any css color value. string   firelogger #315F81 Yes
loggerFGColor Foreground (text) color for badge/label, any css color value. string   firelogger #FFFFFF Yes
loggerName A title for the badge/label on the right of each console logline in FireLogger. string   firelogger CF Yes
maxEncodeDepth Maximum recursion for serializing complex values. numeric   firelogger 30 Yes
maxHeaderLength Maximum length of each response header line (bytes). numeric   firelogger 5000 Yes
obj The variable to be evaluated and logged. Can be any type of value, including complex types such as structures and objects. Undefined by default any   firelogger - Yes
password FireLogger password, if one is being used (blank if not). Use setPassword('pass') to set. Or during init(password='pass'). string   firelogger   Yes
text The plain-text message to be logged. string   firelogger   Yes
type The message type. Can be one of: debug, info, warning, error, exception string   firelogger debug Yes
valuesAlreadySerialized Set this to true if complex data being logged is already valid JSON. Saves time evaluating if it needs to be serialized. boolean   firelogger false Yes
version CF FireLogger version number (read-only). numeric   firelogger - Yes

 

buildHeaders*
private void buildHeaders ( array data, string format="firelogger" )

Builds variables.headers structure of headername:value pairs for the logging output based on the passed-in array of data strings.

Output: suppressed
Parameters:
   data: array, optional, data
   format: string, optional, format
 
clientVersionCheck*
private void clientVersionCheck ( )

Check console logger version against expected version and output warning in the response headers if mismatch.

Output: suppressed
 
critical
public boolean critical ( )

critical type proxy function for log() See docs for log().

Output:
 
doLog*
private boolean doLog ( )

this is actually the main logging function... but "log()" is also a built-in CF function name, so we don't really want to use it as then we have to call this.log() internally which "pollutes" the tag call stack. (output: true because we might have to dump output to the browser in case a fallback method is necessary. Would be nice if this could be dynamic based on the debug variable.)

Output: enabled
 
encodeJSON
public string encodeJSON ( required any data, numeric encodeDepth="0", boolean stringNumbers="false", boolean formatDates="true", string skipKeys="", boolean skipKeysRecursive="false", boolean preserveArrays="false", numeric preserveArraysRecurseLevels="2" )

Converts data from CF to structured JSON format.

Output: enabled
Parameters:
   data: any, required, data
   encodeDepth: numeric, optional, encodeDepth
   stringNumbers: boolean, optional, stringNumbers
   formatDates: boolean, optional, formatDates
   skipKeys: string, optional, skipKeys
   skipKeysRecursive: boolean, optional, skipKeysRecursive
   preserveArrays: boolean, optional, preserveArrays
   preserveArraysRecurseLevels: numeric, optional, preserveArraysRecurseLevels
 
err
public void err ( msg, e="[runtime expression]" )

Error handler for "soft" errors. Can be used to return a special error type header to FireLogger console which shows up at the top with a red background and expands to show a stack trace. Public becaues frelogger.cfm debug template can also use this.

Output:
Parameters:
   msg: any, optional, msg - plain text message to log
   e: any, optional, e - error object (result of catch)
 
error
public boolean error ( )

error type proxy function for log() See docs for log().

Output:
 
fireloggerPasswordCheck*
private boolean fireloggerPasswordCheck ( )

Returns true/false based on if password is required and, if it is, if it matches the one set in the http headers.

Output: suppressed
 
formatErrorOutput
public struct formatErrorOutput ( text="", e="[runtime expression]" )

Formats the result of an error object (cfcatch). Returns a structure with 4 members. text: is the full message to log. exc_info: is an array in the proper format for FireLogger stack trace output. filename: the file with the error (first file in stack trace) lineno: the line number the actual error occured in (from first entry in stack trace)

Output: suppressed
Parameters:
   text: any, optional, text
   e: any, optional, e
 
getCallerFileLine*
private array getCallerFileLine ( )

Gets the calling template and line number from current stack trace,

Output:
 
GETDEBUGLEVEL
public string GETDEBUGLEVEL ( )

Output:
 
GETDEBUGMODE
public boolean GETDEBUGMODE ( )

Output:
 
GETDEBUGTRACEINLINE
public boolean GETDEBUGTRACEINLINE ( )

Output:
 
GETFALLBACKLOGMETHOD
public string GETFALLBACKLOGMETHOD ( )

Output:
 
GETISCONSOLEENABLED
public boolean GETISCONSOLEENABLED ( )

Output:
 
GETLOGGERBGCOLOR
public string GETLOGGERBGCOLOR ( )

Output:
 
GETLOGGERFGCOLOR
public string GETLOGGERFGCOLOR ( )

Output:
 
GETLOGGERNAME
public string GETLOGGERNAME ( )

Output:
 
GETOBJ
public any GETOBJ ( )

Output:
 
getParameters*
private struct getParameters ( )

Gets current settable properties from variables scope and returns them as a new structure

Output:
 
GETTEXT
public string GETTEXT ( )

Output:
 
GETTYPE
public string GETTYPE ( )

Output:
 
GETVERSION
public numeric GETVERSION ( )

Output:
 
info
public boolean info ( )

info type proxy function for log() See docs for log().

Output:
 
init
public any init ( )

Initialization routine. Returns an instance of this component. Specify any properties to set as named arguments. Example: logger = new firelogger(password='pass', debugMode=true);

Output: suppressed
 
log
public boolean log ( )

Log a record to the console. Usage: log([level,] [message,] [object] [, object]...) Where: level = one of: debug (default), warning, info, error, critical. message = text to log; may contain simple-value variables. object = one or more values to log, of any type. note: at least one of a message or object is required, otherwise function exits w/out doing anything. Any arguments passed to this method are do not override the component-wide default. For example, setting the log type here does not change the default log type. Default log type can be set with setType("type");

Output:
 
logProxy*
private boolean logProxy ( string type="", required struct args )

used by doLog() "proxy" functions warn(), info(), error(), critical()

Output:
Parameters:
   type: string, optional, type
   args: struct, required, args
 
panic*
private void panic ( msg, e="[runtime expression]" )

Handle errors where we can't set a header in response, eg. after output has been flushed or if we die while building the output. Tries to log the original request to the fallback handler (eg. trace or writedump).

Output: enabled
Parameters:
   msg: any, optional, msg - plain text message to log
   e: any, optional, e - error object (result of catch)
 
resetLoggerBadge
public void resetLoggerBadge ( boolean resetName="true", boolean resetColors="true" )

Sets the "badge" settings to default. The badge is the colored label that appears on the right of each logged line in FireLogger.

Output:
Parameters:
   resetName: boolean, optional, resetName
   resetColors: boolean, optional, resetColors
 
sendHeaders*
private void sendHeaders ( )

Sets http headers with the logging output for use by the console.

Output: suppressed
 
SETDEBUGLEVEL
public void SETDEBUGLEVEL ( required string debugLevel )

Output:
Parameters:
   debugLevel: string, required, debugLevel
 
SETDEBUGMODE
public void SETDEBUGMODE ( required boolean debugMode )

Output:
Parameters:
   debugMode: boolean, required, debugMode
 
SETDEBUGTRACEINLINE
public void SETDEBUGTRACEINLINE ( required boolean debugTraceInline )

Output:
Parameters:
   debugTraceInline: boolean, required, debugTraceInline
 
SETFALLBACKLOGMETHOD
public void SETFALLBACKLOGMETHOD ( required string fallbackLogMethod )

Output:
Parameters:
   fallbackLogMethod: string, required, fallbackLogMethod
 
SETFILENAME
public void SETFILENAME ( required string filename )

Output:
Parameters:
   filename: string, required, filename
 
setIsConsoleEnabled*
private boolean setIsConsoleEnabled ( )

Overall check to see if browser console is enabled

Output: suppressed
 
SETLINENO
public void SETLINENO ( required string lineno )

Output:
Parameters:
   lineno: string, required, lineno
 
SETLOGGERBGCOLOR
public void SETLOGGERBGCOLOR ( required string loggerBGColor )

Output:
Parameters:
   loggerBGColor: string, required, loggerBGColor
 
SETLOGGERFGCOLOR
public void SETLOGGERFGCOLOR ( required string loggerFGColor )

Output:
Parameters:
   loggerFGColor: string, required, loggerFGColor
 
SETLOGGERNAME
public void SETLOGGERNAME ( required string loggerName )

Output:
Parameters:
   loggerName: string, required, loggerName
 
SETMAXENCODEDEPTH
public void SETMAXENCODEDEPTH ( required numeric maxEncodeDepth )

Output:
Parameters:
   maxEncodeDepth: numeric, required, maxEncodeDepth
 
SETMAXHEADERLENGTH
public void SETMAXHEADERLENGTH ( required numeric maxHeaderLength )

Output:
Parameters:
   maxHeaderLength: numeric, required, maxHeaderLength
 
SETOBJ
public void SETOBJ ( required any obj )

Output:
Parameters:
   obj: any, required, obj
 
setParameters*
private void setParameters ( struct args, struct target="[runtime expression]" )

Set properties based on passed named arguments, making sure they are allowed to be set.

Output:
Parameters:
   args: struct, optional, args
   target: struct, optional, target
 
setPassword
public boolean setPassword ( required string pass )

Method to set a firelogger password

Output: suppressed
Parameters:
   pass: string, required, pass
 
SETTEXT
public void SETTEXT ( required string text )

Output:
Parameters:
   text: string, required, text
 
SETTYPE
public void SETTYPE ( required string type )

Output:
Parameters:
   type: string, required, type
 
SETVALUESALREADYSERIALIZED
public void SETVALUESALREADYSERIALIZED ( required boolean valuesAlreadySerialized )

Output:
Parameters:
   valuesAlreadySerialized: boolean, required, valuesAlreadySerialized
 
splitStrToArray*
private array splitStrToArray ( string data, numeric size="[runtime expression]" )

Splits a string into an array of strings of the specified size.

Output: suppressed
Parameters:
   data: string, optional, data
   size: numeric, optional, size
 
typeFL2CF*
private string typeFL2CF ( string type )

Converts firelogger style logging types (severity levels) to CF types

Output:
Parameters:
   type: string, optional, type
 
warn
public boolean warn ( )

Warning type proxy function for log(). See docs for log().

Output: