Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
Log

Package | mx.logging
Class | public class Log
Inheritance | Log Object

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Provides pseudo-hierarchical logging capabilities with multiple format and output options. The log system consists of two major components, the logger and a target. You can use the logger to send information to a target. The target is responsible for formatting and general output of the log data.

Loggers are singleton instances created for a particular category of information. Typically, the category is the package name of the component that desires to log information. The category provides users the ability to specify what log information they are interested in. Multiple categories can be selected and combined with regular expressions. This allows for both broad and narrow logging information to be acquired. For example, you might be interested in all logging information under the "mx.messaging" and "mx.rpc" packages and want the output from these packages to be formatted as XML. To get the all of the logging information under the "mx.messaging" category including sub-packages and components a wildcard expression is required, such as "mx.messaging.*". See the code example below for more details.

Targets provide the output mechanism of the data being logged. This mechanism typically includes formatting, transmission, or storage, but can be anything possible under the VM. There are two targets provided: `MiniDebugTarget` and `TraceTarget`. Each of these writers take the current log information and "sends" it somewhere for display and/or storage. Targets also provide the specification of what log data to output.

Public Methods

| Method | Defined By
--- | --- | ---
|  | addTarget(target:ILoggingTarget):void [static] Allows the specified target to begin receiving notification of log events. | Log
|  | flush():void [static] This method removes all of the current loggers from the cache. | Log
|  | getLogger(category:String):ILogger [static] Returns the logger associated with the specified category. | Log
|  | hasIllegalCharacters(value:String):Boolean [static] This method checks the specified string value for illegal characters. | Log
|  | isDebug():Boolean [static] Indicates whether a debug level log event will be processed by a log target. | Log
|  | isError():Boolean [static] Indicates whether an error level log event will be processed by a log target. | Log
|  | isFatal():Boolean [static] Indicates whether a fatal level log event will be processed by a log target. | Log
|  | isInfo():Boolean [static] Indicates whether an info level log event will be processed by a log target. | Log
|  | isWarn():Boolean [static] Indicates whether a warn level log event will be processed by a log target. | Log
|  | removeTarget(target:ILoggingTarget):void [static] Stops the specified target from receiving notification of log events. | Log

Method Detail

addTarget | () | method

`public static function addTarget(target:ILoggingTarget):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Allows the specified target to begin receiving notification of log events.

Parameters

| `target:ILoggingTarget` — specific target that should capture log events.

flush | () | method |

`public static function flush():void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

This method removes all of the current loggers from the cache. Subsquent calls to the `getLogger()` method return new instances of loggers rather than any previous instances with the same category. This method is intended for use in debugging only.

getLogger | () | method |

`public static function getLogger(category:String):ILogger`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Returns the logger associated with the specified category. If the category given doesn't exist a new instance of a logger will be returned and associated with that category. Categories must be at least one character in length and may not contain any blanks or any of the following characters: []~$^&\/(){}<>+=`!#%?,:;'"@ This method will throw an `InvalidCategoryError` if the category specified is malformed.

Parameters

| `category:String` — The category of the logger that should be returned.

Returns

| `ILogger` — An instance of a logger object for the specified name. If the name doesn't exist, a new instance with the specified name is returned.

hasIllegalCharacters | () | method |

`public static function hasIllegalCharacters(value:String):Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

This method checks the specified string value for illegal characters.

Parameters

| `value:String` — The String to check for illegal characters. The following characters are not valid: []~$^&\/(){}<>+=`!#%?,:;'"@

Returns

| `Boolean` — `true` if there are any illegal characters found, `false` otherwise

isDebug | () | method |

`public static function isDebug():Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Indicates whether a debug level log event will be processed by a log target.

Returns

| `Boolean` — true if a debug level log event will be logged; otherwise false.

isError | () | method |

`public static function isError():Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Indicates whether an error level log event will be processed by a log target.

Returns

| `Boolean` — true if an error level log event will be logged; otherwise false.

isFatal | () | method |

`public static function isFatal():Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Indicates whether a fatal level log event will be processed by a log target.

Returns

| `Boolean` — true if a fatal level log event will be logged; otherwise false.

isInfo | () | method |

`public static function isInfo():Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Indicates whether an info level log event will be processed by a log target.

Returns

| `Boolean` — true if an info level log event will be logged; otherwise false.

isWarn | () | method |

`public static function isWarn():Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Indicates whether a warn level log event will be processed by a log target.

Returns

| `Boolean` — true if a warn level log event will be logged; otherwise false.

removeTarget | () | method |

`public static function removeTarget(target:ILoggingTarget):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Stops the specified target from receiving notification of log events.

Parameters

| `target:ILoggingTarget` — specific target that should capture log events.

Wed Nov 15 2017, 09:50 AM +01:00