| Package: MachII.logging.adapters |
| A logging adapter. This is abstract and must be extend by a concrete adapter implementation. |
<!--- License: Copyright 2008 GreatBizTools, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright: GreatBizTools, LLC Author: Peter J. Farrell (peter@mach-ii.com) $Id: AbstractLogAdapter.cfc 625 2008-01-29 21:45:06Z peterfarrell $ Created version: 1.6.0 Updated version: 1.6.0 Notes: ---> |
| Method Summary | |
|---|---|
| public AbstractLogAdapter |
init(struct parameters)
Initializes the logging adapter. Do not override. |
| public void |
configure()
Configures the adapter. Override to provide custom functionality. |
| public void |
debug(string channel, string message, [any caughtException])
Logs a message with debug log level. |
| public void |
disableLogging()
Disables logging. |
| public void |
enableLogging()
Enables logging. |
| public void |
error(string channel, string message, [any caughtException])
Logs a message with error log level. |
| public void |
fatal(string channel, string message, [any caughtException])
Logs a message with fatal log level. |
| public AbstractFilter |
getFilter()
Gets the filter. |
| public boolean |
getLoggingEnabled()
Gets the logging enabled. |
| public string |
getLoggingLevel()
Returns the logging level by name. Required for Dashboard integration. |
| public any |
getParameter(string name, [string defaultValue=""])
Gets a configuration parameter value, or a default value if not defined. |
| public struct |
getParameters()
Gets the full set of configuration parameters for the component. |
| public void |
info(string channel, string message, [any caughtException])
Logs a message with info log level. |
| public boolean |
isDebugEnabled()
Checks if debug level logging is enabled. |
| public boolean |
isErrorEnabled()
Checks if error level logging is enabled. |
| public boolean |
isFatalEnabled()
Checks if fatal level logging is enabled. |
| public boolean |
isFilterDefined()
Checks if a filter has been defined for this adapter. |
| public boolean |
isInfoEnabled()
Checks if info level logging is enabled. |
| public boolean |
isParameterDefined(string name)
Checks to see whether or not a configuration parameter is defined. |
| public boolean |
isTraceEnabled()
Checks if trace level logging is enabled. |
| public boolean |
isWarnEnabled()
Checks if warn level logging is enabled. |
| public void |
setFilter(AbstractFilter filter)
Sets the filter. |
| public void |
setLoggingEnabled(boolean loggingEnabled)
Sets the logging enabled. |
| public void |
setParameter(string name, any value)
Sets a configuration parameter. |
| public void |
setParameters(struct parameters)
Sets the full set of configuration parameters for the component. |
| public void |
trace(string channel, string message, [any caughtException])
Logs a message with trace log level. |
| public void |
warn(string channel, string message, [any caughtException])
Logs a message with warn log level. |
| Method Detail |
|---|
| configure |
|---|
public void configure( )
Configures the adapter. Override to provide custom functionality.
Parameters:
Code:
<cffunction name="configure" access="public" returntype="void" output="false" hint="Configures the adapter. Override to provide custom functionality."> </cffunction>
| debug |
|---|
public void debug( string channel, string message, [any caughtException] )
Logs a message with debug log level.
Parameters:
| string channel |
| string message |
| [any caughtException] |
Code:
<cffunction name="debug" access="public" returntype="void" output="false" hint="Logs a message with debug log level."> <cfargument name="channel" type="string" required="true" /> <cfargument name="message" type="string" required="true" /> <cfargument name="caughtException" type="any" required="false" /> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| disableLogging |
|---|
public void disableLogging( )
Disables logging.
Parameters:
Code:
<cffunction name="disableLogging" access="public" returntype="void" output="false" hint="Disables logging."> <cfset setLoggingEnabled(false) /> </cffunction>
| enableLogging |
|---|
public void enableLogging( )
Enables logging.
Parameters:
Code:
<cffunction name="enableLogging" access="public" returntype="void" output="false" hint="Enables logging."> <cfset setLoggingEnabled(true) /> </cffunction>
| error |
|---|
public void error( string channel, string message, [any caughtException] )
Logs a message with error log level.
Parameters:
| string channel |
| string message |
| [any caughtException] |
Code:
<cffunction name="error" access="public" returntype="void" output="false" hint="Logs a message with error log level."> <cfargument name="channel" type="string" required="true" /> <cfargument name="message" type="string" required="true" /> <cfargument name="caughtException" type="any" required="false" /> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| fatal |
|---|
public void fatal( string channel, string message, [any caughtException] )
Logs a message with fatal log level.
Parameters:
| string channel |
| string message |
| [any caughtException] |
Code:
<cffunction name="fatal" access="public" returntype="void" output="false" hint="Logs a message with fatal log level."> <cfargument name="channel" type="string" required="true" /> <cfargument name="message" type="string" required="true" /> <cfargument name="caughtException" type="any" required="false" /> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| getFilter |
|---|
public AbstractFilter getFilter( )
Gets the filter.
Parameters:
Code:
<cffunction name="getFilter" access="public" returntype="MachII.logging.filters.AbstractFilter" output="false" hint="Gets the filter."> <cfreturn variables.filter /> </cffunction>
| getLoggingEnabled |
|---|
public boolean getLoggingEnabled( )
Gets the logging enabled.
Parameters:
Code:
<cffunction name="getLoggingEnabled" access="public" returntype="boolean" output="false" hint="Gets the logging enabled."> <cfreturn variables.loggingEnabled /> </cffunction>
| getLoggingLevel |
|---|
public string getLoggingLevel( )
Returns the logging level by name. Required for Dashboard integration.
Parameters:
Code:
<cffunction name="getLoggingLevel" access="public" returntype="string" output="false" hint="Returns the logging level by name. Required for Dashboard integration."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| getParameter |
|---|
public any getParameter( string name, [string defaultValue=""] )
Gets a configuration parameter value, or a default value if not defined.
Parameters:
| string name |
| [string defaultValue=""] |
Code:
<cffunction name="getParameter" access="public" returntype="any" output="false" hint="Gets a configuration parameter value, or a default value if not defined."> <cfargument name="name" type="string" required="true" hint="The parameter name." /> <cfargument name="defaultValue" type="string" required="false" default="" hint="The default value to return if the parameter is not defined. Defaults to a blank string." /> <cfif isParameterDefined(arguments.name)> <cfreturn variables.parameters[arguments.name] /> <cfelse> <cfreturn arguments.defaultValue /> </cfif> </cffunction>
| getParameters |
|---|
public struct getParameters( )
Gets the full set of configuration parameters for the component.
Parameters:
Code:
<cffunction name="getParameters" access="public" returntype="struct" output="false" hint="Gets the full set of configuration parameters for the component."> <cfreturn variables.parameters /> </cffunction>
| info |
|---|
public void info( string channel, string message, [any caughtException] )
Logs a message with info log level.
Parameters:
| string channel |
| string message |
| [any caughtException] |
Code:
<cffunction name="info" access="public" returntype="void" output="false" hint="Logs a message with info log level."> <cfargument name="channel" type="string" required="true" /> <cfargument name="message" type="string" required="true" /> <cfargument name="caughtException" type="any" required="false" /> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| init |
|---|
public AbstractLogAdapter init( struct parameters )
Initializes the logging adapter. Do not override.
Parameters:
| struct parameters |
Code:
<cffunction name="init" access="public" returntype="AbstractLogAdapter" output="false" hint="Initializes the logging adapter. Do not override."> <cfargument name="parameters" type="struct" required="true" /> <cfset setParameters(arguments.parameters) /> <cfreturn this /> </cffunction>
| isDebugEnabled |
|---|
public boolean isDebugEnabled( )
Checks if debug level logging is enabled.
Parameters:
Code:
<cffunction name="isDebugEnabled" access="public" returntype="boolean" output="false" hint="Checks if debug level logging is enabled."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| isErrorEnabled |
|---|
public boolean isErrorEnabled( )
Checks if error level logging is enabled.
Parameters:
Code:
<cffunction name="isErrorEnabled" access="public" returntype="boolean" output="false" hint="Checks if error level logging is enabled."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| isFatalEnabled |
|---|
public boolean isFatalEnabled( )
Checks if fatal level logging is enabled.
Parameters:
Code:
<cffunction name="isFatalEnabled" access="public" returntype="boolean" output="false" hint="Checks if fatal level logging is enabled."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| isFilterDefined |
|---|
public boolean isFilterDefined( )
Checks if a filter has been defined for this adapter.
Parameters:
Code:
<cffunction name="isFilterDefined" access="public" returntype="boolean" output="false" hint="Checks if a filter has been defined for this adapter."> <cfreturn IsObject(variables.filter) /> </cffunction>
| isInfoEnabled |
|---|
public boolean isInfoEnabled( )
Checks if info level logging is enabled.
Parameters:
Code:
<cffunction name="isInfoEnabled" access="public" returntype="boolean" output="false" hint="Checks if info level logging is enabled."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| isParameterDefined |
|---|
public boolean isParameterDefined( string name )
Checks to see whether or not a configuration parameter is defined.
Parameters:
| string name |
Code:
<cffunction name="isParameterDefined" access="public" returntype="boolean" output="false" hint="Checks to see whether or not a configuration parameter is defined."> <cfargument name="name" type="string" required="true" hint="The parameter name." /> <cfreturn StructKeyExists(variables.parameters, arguments.name) /> </cffunction>
| isTraceEnabled |
|---|
public boolean isTraceEnabled( )
Checks if trace level logging is enabled.
Parameters:
Code:
<cffunction name="isTraceEnabled" access="public" returntype="boolean" output="false" hint="Checks if trace level logging is enabled."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| isWarnEnabled |
|---|
public boolean isWarnEnabled( )
Checks if warn level logging is enabled.
Parameters:
Code:
<cffunction name="isWarnEnabled" access="public" returntype="boolean" output="false" hint="Checks if warn level logging is enabled."> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| setFilter |
|---|
public void setFilter( AbstractFilter filter )
Sets the filter.
Parameters:
| AbstractFilter filter |
Code:
<cffunction name="setFilter" access="public" returntype="void" output="false" hint="Sets the filter."> <cfargument name="filter" type="MachII.logging.filters.AbstractFilter" required="true" /> <cfset variables.filter = arguments.filter /> </cffunction>
| setLoggingEnabled |
|---|
public void setLoggingEnabled( boolean loggingEnabled )
Sets the logging enabled.
Parameters:
| boolean loggingEnabled |
Code:
<cffunction name="setLoggingEnabled" access="public" returntype="void" output="false" hint="Sets the logging enabled."> <cfargument name="loggingEnabled" type="boolean" required="true" /> <cfset variables.loggingEnabled = arguments.loggingEnabled /> </cffunction>
| setParameter |
|---|
public void setParameter( string name, any value )
Sets a configuration parameter.
Parameters:
| string name |
| any value |
Code:
<cffunction name="setParameter" access="public" returntype="void" output="false" hint="Sets a configuration parameter."> <cfargument name="name" type="string" required="true" hint="The parameter name." /> <cfargument name="value" required="true" hint="The parameter value." /> <cfset variables.parameters[arguments.name] = arguments.value /> </cffunction>
| setParameters |
|---|
public void setParameters( struct parameters )
Sets the full set of configuration parameters for the component.
Parameters:
| struct parameters |
Code:
<cffunction name="setParameters" access="public" returntype="void" output="false" hint="Sets the full set of configuration parameters for the component."> <cfargument name="parameters" type="struct" required="true" /> <cfset var key = "" /> <cfloop collection="#arguments.parameters#" item="key"> <cfset setParameter(key, parameters[key]) /> </cfloop> </cffunction>
| trace |
|---|
public void trace( string channel, string message, [any caughtException] )
Logs a message with trace log level.
Parameters:
| string channel |
| string message |
| [any caughtException] |
Code:
<cffunction name="trace" access="public" returntype="void" output="false" hint="Logs a message with trace log level."> <cfargument name="channel" type="string" required="true" /> <cfargument name="message" type="string" required="true" /> <cfargument name="caughtException" type="any" required="false" /> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>
| warn |
|---|
public void warn( string channel, string message, [any caughtException] )
Logs a message with warn log level.
Parameters:
| string channel |
| string message |
| [any caughtException] |
Code:
<cffunction name="warn" access="public" returntype="void" output="false" hint="Logs a message with warn log level."> <cfargument name="channel" type="string" required="true" /> <cfargument name="message" type="string" required="true" /> <cfargument name="caughtException" type="any" required="false" /> <cfabort showerror="This method is abstract and must be overrided." /> </cffunction>