as3
Javascript
code posted
created at 24 Feb 12:42
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
package org.axgl.util { import flash.external.ExternalInterface; public class AxLogger { public static const DEBUG:String = "debug"; public static const LOG:String = "log"; public static const WARN:String = "warn"; public static const ERROR:String = "error"; private var external:Boolean = false; public function AxLogger() { this.external = ExternalInterface.available; } public function debug(... arguments):void { send(arguments, DEBUG); } public function log(... arguments):void { send(arguments, LOG); } public function warn(... arguments):void { send(arguments, WARN); } public function error(... arguments):void { send(arguments, ERROR); } private function send(arguments:Object, level:String = LOG):void { for (var i:String in arguments) { if (external && level != DEBUG) { ExternalInterface.call("console." + level, arguments[i]); } trace(arguments[i]); } } } } |
1018 Bytes in 5 ms with coderay