MultiPrinter
Class Description
Provides a one-to-many facade for logging a single message to multiple printers.
See Also
Listing
Constructor
MultiPrinter() |
Fields
printers():Dictionary.<String, Printer> | List of message receivers compliant with the Printer interface. |
index():Number | Value used to generate a default index for the next printer added. |
Properties
numPrinters():Number | read only Count of printers currently in the list of message receivers. |
printerKeys():Vector.<String> | read only Keys for all printers currently in the list of message receivers. |
Methods
print(message:String):void | Record a log message. |
add(printer:Printer, key:String=null):String | Add a printer to the list of message recievers. |
clear():void | Remove all printers from the list of message receivers. |
remove(key:String):Printer | Remove a printer matching the provided key from the list of message recievers. |
Details
Constructor
MultiPrinter()
public function MultiPrinter()
Fields
printers
protected printers():Dictionary.<String, Printer>
List of message receivers compliant with the Printer
interface.
All printers in the list are printed to each time the print()
method of this class is called.
See Also
index
protected index():Number
Value used to generate a default index for the next printer added.
Properties
numPrintersread only
public numPrinters():Number
Count of printers currently in the list of message receivers.
returns Number | The number of printers currently in the list of message receivers |
printerKeysread only
public printerKeys():Vector.<String>
Keys for all printers currently in the list of message receivers.
returns Vector.<String> | A |
Methods
print()
public function print(message:String):void
Record a log message.
Message formatting occurs prior to this method being called.
message:String | The formatted message to be handled by a log receiver |
add()
public function add(printer:Printer, key:String=null):String
Add a printer to the list of message recievers.
Each printer in the list will record any message send to the print()
method of this class.
See Also
printer:Printer | A message receiver compliant with the |
key:String=null | optional An optional key to store the printer under. When not provided, a default key is created. |
returns String | The key for the added printer. Can be used for removal. |
clear()
public function clear():void
Remove all printers from the list of message receivers.