Sujets sur : monster debugge
Cours ActionScript 3 ‘monster debugge’
Compatibilité Pixlib 3.0 et Monster Debugger 3

Pour la création d’une application avec le Framework Pixlib 3.0, j’ai ajouté une petite modification concernant le debug.
Pour l’instant Pixlib est compatible uniquement avec la version 2 de Monster Debugger.
Du coup, ce n’est pas très pratique pour votre debug dans Flash !
Si comme moi, vous utilisez la version 3 de Monster Debugger, vous apprécierez surement de profiter de ces nouvelles fonctionnalités de debug avancées.
Pour cela, j’ai juste modifié 2 lignes de code dans la classe PXDeMonsterDebuggerLayout.as et le tour est joué 😉
Pixlib 3 envoie ses traces dans la console Monster Debugger 3.01 😉
Ci-dessous le code complet du Framework Pixlib 3.0 avec l’extension PixLogger modifiée.
Les 2 lignes de codes modifiées :
[codesyntax lang= »actionscript3″ title= »PXDeMonsterDebuggerLayout.as » bookmarkname= »PXDeMonsterDebuggerLayout.as »]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /** * Default De MonsterDebugger client root target. * * @default null Use the PXbApplication.getInstance().root if * defined. * * @langversion 3.0 * @playerversion Flash 10 */ public static var ROOT : Object = PXApplication.getInstance().root; // -------------------------------------------------------------------- // Private implementation // -------------------------------------------------------------------- /** * @private */ function PXDeMonsterDebuggerLayout() { CLIENT["initialize"](ROOT); initColorMap(); if (AUTO_CLEAR) onClear(); } |
[/codesyntax]
La classe PXDeMonsterDebuggerLayout.as complète :
[codesyntax lang= »actionscript3″ title= »PXDeMonsterDebuggerLayout.as » bookmarkname= »PXDeMonsterDebuggerLayout.as »]
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /* * Copyright the original author or authors. * * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (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.mozilla.org/MPL/MPL-1.1.html * * 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. */ package net.pixlib.log.layout { import net.pixlib.core.PXApplication; import com.demonsters.debugger.MonsterDebugger; import net.pixlib.log.PXStringifier; import net.pixlib.collections.PXHashMap; import net.pixlib.log.PXLogEvent; import net.pixlib.log.PXLogLevel; import net.pixlib.log.PXLogListener; import flash.events.Event; /** * The PXDeMonsterDebuggerLayout class provides a convenient way * to output messages through <strong>De MonsterDebugger</strong> AIR application. * * @example Basic example * <listing> * * PXDeMonsterDebuggerLayout.CLIENT = MonsterDebugger; * PXLogManager.getInstance().addLogListener(PXDeMonsterDebuggerLayout.getInstance()); * </listing> * * @example Customize De MonsterDebugger client class * <listing> * * PXDeMonsterDebuggerLayout.CLIENT = MyDeMonsterClient; * PXDeMonsterDebuggerLayout.AUTO_CLEAR = false; * * PXLogManager.getInstance().addLogListener(PXDeMonsterDebuggerLayout.getInstance()); * </listing> * * @see #CLIENT Customize De MonsterDebugger client class * @see PIXLIB_DOC/net/pixlib/log/PXLogManager.html net.pixlib.log.PXLogManager * @see PIXLIB_DOC/net/pixlib/log/PXLogListener net.pixlib.log.PXLogListener * @see PIXLIB_DOC/net/pixlib/log/PXLogLevel net.pixlib.log.PXLogLevel * @see http://www.demonsterdebugger.com De MonsterDebugger site * * @langversion 3.0 * @playerversion Flash 10 * * @author Romain Ecarnot */ final public class PXDeMonsterDebuggerLayout implements PXLogListener { // -------------------------------------------------------------------- // Private properties // -------------------------------------------------------------------- /** * @private */ private static var _oI : PXDeMonsterDebuggerLayout ; // -------------------------------------------------------------------- // Protected properties // -------------------------------------------------------------------- /** * @private * * @langversion 3.0 * @playerversion Flash 10 */ protected var mColorLevel : PXHashMap; // -------------------------------------------------------------------- // Public properties // -------------------------------------------------------------------- /** * The De MonsterDebugger client class to user. * * @default net.pixlib.log.layout.MonsterDebugger class * * @langversion 3.0 * @playerversion Flash 10 */ public static var CLIENT : Class = MonsterDebugger; /** * Default De MonsterDebugger client root target. * * @default null Use the PXbApplication.getInstance().root if * defined. * * @langversion 3.0 * @playerversion Flash 10 */ public static var ROOT : Object = PXApplication.getInstance().root; /** * Indicates if console must be cleared on connection. * * @default true * * @langversion 3.0 * @playerversion Flash 10 */ public static var AUTO_CLEAR : Boolean = true; /** * Method name in DeMonsterDebugger to trace ouput message. * * @default "trace" * * @langversion 3.0 * @playerversion Flash 10 */ public static var DEBUG_METHOD : String = "trace"; /** * Method name in DeMonsterDebugger to clear ouput messages. * * @default "clearTraces" * * @langversion 3.0 * @playerversion Flash 10 */ public static var CLEAR_METHOD : String = "clearTraces"; /** * The depth of the trace. * * @default 4 * * @langversion 3.0 * @playerversion Flash 10 */ public static var DEPTH : uint = 4; /** * Display the public methods of a Class in the output panel. * * @default false * * @langversion 3.0 * @playerversion Flash 10 */ public static var FUNCTIONS : Boolean = false; // -------------------------------------------------------------------- // Public API // -------------------------------------------------------------------- /** * Returns uniqe instance of PXDeMonsterDebuggerLayout class. * * @return Unique instance of PXDeMonsterDebuggerLayout class. * * @langversion 3.0 * @playerversion Flash 10 */ public static function getInstance() : PXDeMonsterDebuggerLayout { if (!_oI) _oI = new PXDeMonsterDebuggerLayout(); return _oI; } /** * Releases instance. * * @langversion 3.0 * @playerversion Flash 10 */ public static function release() : void { if ( PXDeMonsterDebuggerLayout._oI is PXDeMonsterDebuggerLayout ) PXDeMonsterDebuggerLayout._oI = null; } /** * Triggered when a log message has to be sent.(from the PXLogManager) * * @param event The vent containing information about the message * to log. * * @langversion 3.0 * @playerversion Flash 10 */ public function onLog(event : PXLogEvent) : void { if ( CLIENT.hasOwnProperty(DEBUG_METHOD) ) { CLIENT[ DEBUG_METHOD ](event.logTarget, event.message, mColorLevel.get(event.level), FUNCTIONS, DEPTH); } } /** * Clears console. * * @langversion 3.0 * @playerversion Flash 10 */ public function onClear(event : Event = null) : void { if ( CLIENT.hasOwnProperty(CLEAR_METHOD) ) { CLIENT[ CLEAR_METHOD ](); } } /** * Returns string representation of instance. * * @return The string representation of instance. * * @langversion 3.0 * @playerversion Flash 10 */ public function toString() : String { return PXStringifier.process(this); } // -------------------------------------------------------------------- // Protected methods // -------------------------------------------------------------------- /** * @private * * @langversion 3.0 * @playerversion Flash 10 */ protected function initColorMap() : void { mColorLevel = new PXHashMap(); mColorLevel.put(PXLogLevel.ALL, 0x666666); mColorLevel.put(PXLogLevel.DEBUG, 0x0086B3); mColorLevel.put(PXLogLevel.INFO, 0x00B32D); mColorLevel.put(PXLogLevel.WARN, 0xB38600); mColorLevel.put(PXLogLevel.ERROR, 0xB32D00); mColorLevel.put(PXLogLevel.FATAL, 0xB3002D); } // -------------------------------------------------------------------- // Private implementation // -------------------------------------------------------------------- /** * @private */ function PXDeMonsterDebuggerLayout() { CLIENT["initialize"](ROOT); initColorMap(); if (AUTO_CLEAR) onClear(); } } } |
[/codesyntax]
Téléchargement Pixlib 3.0 avec Extension PixLogger
Pour vous faciliter encore plus la tâche, ci-dessous l’archive zip complète de Pixlib 3.0 avec l’extension PixLogger compatible Monster Debugger 3.01.
Télécharger “Pixlib 3.0 avec extension PixLogger pour De Monster Debugger 3” Pixlib_3.0-extension_PixLogger-De_Monster_Debugger.zip – Téléchargé 882 fois – 673,71 Ko