Damien Pegoraro

Le trace, ca lasse…

Après une longue et pénible étude de cas portant sur plus de 10 000 applications scrupuleusement sélectionnées, mes conclusions sont formelles :

La fonction trace() de flash n’est décidément pas très pratique et reste surtout globalement inutilisable en ligne.

Depuis longtemps les hommes de toutes nationalités se sont unis dans un effort commun pour offrir aux créateurs de web que nous sommes des alternatives toutes plus séduisantes les unes que les autres pour remplacer cette fonction trace une bonne fois pour toutes.

On peut citer par exemple le Flash Inspector, aujourd’hui devenu pratiquement introuvable, même sur eBay :

le désormais célèbre Air Logger de Abe, gérant le debug multi flash et plein d’autres trucs cools :

Ou encore le fabuleux Monster Debugguer, qui n’en peut plus de repousser les limites du debug de feignasse.

Chaque outil dispose de son mode de dialogue propre et implique l’inclusion de dépendances spécifiques à nos projets.

Certaines méta librairies proposent depuis longtemps des solutions de dialogue avec ces applications pour faciliter la tâche des collègues :

C’est le cas par exemple de Lowra ou de la grandissante librairie de Skitoo.

Les solutions proposées sont complètes, proposant par exemple un système avancé de filtrage des messages, une configuration via du XML et plein d’autres trucs déments.

Toujours dans mon souci de faire comme les autres mais en moins bien, voici une présentation du package net.babeuf.logger dont le but assumé est de proposer l’approche la plus minimaliste possible du trace en ligne en terme de code à insérer dans son projet. J’ai donc délibérément supprimé toute instanciation, initialisation ou autre paramétrages pour ne garder que quelques méthodes statiques :

-fatal ( bouh )

et un booléen enabled pour activer désactiver le tout.

toutes ces méthodes ont le même prototype

debug( message : *, obj : Object = null ) : void

A savoir : le message, sous n’importe quelle forme ( string, number, XML, Object, Array, etc ) et en optionnel une référence vers l’object appelent le trace ( le plus souvent this ou rien du tout) pour s’y retrouver à l’affichage.

A chaque sortie possible correspond une classe présentant ces méthodes statiques à l’application.

net.babeuf.logger.AirLogger -> sortie dans le Air Logger
net.babeuf.logger.Firebug -> sortie dans la console de Firebug
net.babeuf.logger.FlashInspector -> sortie dans le Flash Inspector
net.babeuf.logger.JSAlert -> sortie dans des alertes Javascript
net.babeuf.logger.PopLogger -> sortie dans une popup html
net.babeuf.logger.EveryWhereLogger -> sortie partout en meme temps ( avec un partout paramétrable ) + le trace originel

Gros plan sur le PopLogger seule exclusivité de ce package puisqu’il permet à un flash intégré dans une page HTML d’envoyer des messages vers une popup HTML qui s’ouvre automatiquement.
Aucune inclusion de javascript n’est nécessaire.

PopLogger.debug( "debuggue moi grand fou" ) ;

dans le flash, et c’est tout !

le PopLogger en action

Bien sur, les popups ne doivent pas être bloquées sur votre navigateur sinon, c’est raté.

Le EveryWhereLogger permet quant à lui de cumuler tous les logger en même temps sans réfléchir, ce qui fait du bien une fois de temps en temps dans une dure journée de labeur.

par défaut, toutes les sources sont actives à l’exception du JSAlert, bien lourd à la longue et du PopLogger, qui ne fait pas bien dans une démo client.

Chaque sortie est activable/Désactivable séparément si besoin :

EveryWhereLogger.firebugEnabled = true ;
EveryWhereLogger.flashInspectorEnabled = true ;
EveryWhereLogger.airloggerEnabled = true ;
EveryWhereLogger.alertEnabled = true ;
EveryWhereLogger.popEnabled = true ;

Pour ceux qui n’ont pas encore totalement décroché, une petite démo récapitulant tout ça :

et puisque c’est devenu une habitude, les classes ( dispos sur mon svn ).

Merci de votre attention.

250 Comments on “Le trace, ca lasse…

  1. A lot of thanks for every one of your effort on this blog. Betty takes pleasure in participating in investigation and it’s really easy to understand why. A lot of people know all regarding the powerful mode you make advantageous guides through this website and encourage contribution from website visitors on that subject plus our child is certainly understanding so much. Take pleasure in the rest of the new year. You are always doing a remarkable job.

  2. Thank you for all your efforts on this website. Gloria takes pleasure in making time for research and it’s easy to see why. We all hear all regarding the compelling form you produce advantageous tips and hints through your web blog and in addition foster contribution from people on the topic while our favorite simple princess has been discovering a whole lot. Take pleasure in the rest of the year. You are performing a splendid job.

  3. I definitely wanted to write a simple comment to say thanks to you for the marvelous tricks you are showing at this site. My particularly long internet look up has at the end been honored with sensible facts to write about with my friends. I would repeat that we visitors actually are definitely lucky to live in a really good network with very many special professionals with good basics. I feel quite grateful to have seen the webpages and look forward to many more thrilling minutes reading here. Thank you once again for all the details.

  4. I intended to compose you that tiny remark to thank you so much again on the pleasant pointers you’ve discussed at this time. It was pretty open-handed of people like you to provide without restraint what a number of people might have supplied for an electronic book to help make some cash on their own, most notably seeing that you could have tried it if you ever considered necessary. These principles also acted as the great way to comprehend someone else have a similar eagerness similar to my own to realize a good deal more related to this problem. I think there are numerous more enjoyable sessions up front for those who scan your site.

  5. I want to express some thanks to the writer just for rescuing me from this particular dilemma. Because of surfing around throughout the the web and getting suggestions that were not beneficial, I assumed my entire life was over. Being alive minus the solutions to the issues you have resolved through your article content is a serious case, as well as the ones which might have badly affected my career if I had not encountered your blog post. That expertise and kindness in handling everything was useful. I am not sure what I would have done if I had not come upon such a solution like this. I can also at this moment relish my future. Thanks a lot very much for the impressive and effective guide. I won’t hesitate to endorse your web page to anybody who needs and wants counselling on this subject.

  6. I’m commenting to let you understand of the awesome discovery my girl developed going through your webblog. She learned lots of things, with the inclusion of what it’s like to possess an amazing giving spirit to have other folks without difficulty fully understand various hard to do topics. You really surpassed my desires. Thank you for rendering the powerful, trusted, edifying not to mention cool tips about the topic to Janet.

  7. I am only writing to let you be aware of what a outstanding discovery my friend’s daughter gained using the blog. She came to understand many issues, with the inclusion of how it is like to possess an amazing giving mindset to make other people quite simply know selected hard to do issues. You really surpassed her expectations. Many thanks for giving those good, trusted, explanatory and in addition unique guidance on your topic to Jane.

  8. Hello there! This blog post could not be written any better!
    Going through this post reminds me of my previous roommate!
    He always kept preaching about this. I’ll send this information to him.
    Pretty sure he’ll have a very good read. Many
    thanks for sharing!

  9. I have been browsing online more than three hours today, but I by no means discovered any attention-grabbing article like yours.

    It is pretty price enough for me. In my opinion,
    if all webmasters and bloggers made good content material as
    you probably did, the net might be much more helpful than ever before.

  10. I actually wanted to make a brief word in order to express gratitude to you for all the unique concepts you are giving out here. My time consuming internet research has at the end of the day been honored with good quality points to exchange with my friends and family. I would suppose that most of us website visitors are extremely lucky to dwell in a magnificent site with many brilliant professionals with great principles. I feel pretty fortunate to have encountered your site and look forward to really more fun times reading here. Thanks a lot once more for a lot of things.

  11. It is the best time to make a few plans for the future and it is time to be happy.
    I have learn this publish and if I may just I desire to counsel
    you some attention-grabbing issues or advice.
    Perhaps you can write subsequent articles referring to this article.
    I want to learn even more things approximately it!

  12. I am just commenting to make you understand what a awesome discovery my child had visiting your web page. She came to understand some pieces, including how it is like to have a marvelous helping character to get many people without hassle have an understanding of a variety of impossible topics. You truly exceeded her desires. I appreciate you for providing those good, trusted, informative as well as unique guidance on the topic to Evelyn.

  13. I wanted to post you one tiny note in order to thank you very much over again for your gorgeous guidelines you’ve shared at this time. It’s simply strangely open-handed of you to supply without restraint what exactly some people would’ve offered as an e-book to help with making some dough for themselves, certainly now that you might have done it in the event you desired. These thoughts in addition worked to provide a easy way to know that the rest have similar interest just like mine to see a little more on the subject of this problem. Certainly there are thousands of more fun sessions up front for individuals that start reading your blog.

  14. Hi would you mind letting me know which web host you’re using?
    I’ve loaded your blog in 3 completely different internet browsers and I must
    say this blog loads a lot faster then most. Can you suggest a good internet
    hosting provider at a fair price? Many thanks,
    I appreciate it!

  15. Hello, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam comments?
    If so how do you prevent it, any plugin or anything you can advise?
    I get so much lately it’s driving me crazy so any support
    is very much appreciated.

  16. I have been surfing on-line more than 3 hours as of late, yet I by
    no means found any interesting article like yours. It is beautiful price enough for me.
    In my view, if all web owners and bloggers made excellent content
    as you probably did, the web might be much more useful
    than ever before.

  17. Thank you for your entire efforts on this site. Gloria take interest in conducting investigations and it is easy to understand why. We hear all about the powerful form you deliver effective secrets through your website and even invigorate response from other people on that idea so my child is now learning so much. Enjoy the remaining portion of the year. You are carrying out a powerful job.

  18. Greetings from Los angeles! I’m bored to tears at work so I decided to
    browse your website on my iphone during lunch break.
    I really like the information you provide here and can’t wait to take a look when I get home.
    I’m surprised at how quick your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyways, wonderful blog!

  19. Ahaa, its nice conversation regarding this piece of writing at this place at
    this web site, I have read all that, so now me also commenting here.

  20. I’ll immediately seize your rss feed as I can not in finding your e-mail subscription link or e-newsletter service.
    Do you’ve any? Kindly allow me realize so that I could subscribe.

  21. My husband and i got quite thankful when Ervin managed to complete his investigation because of the ideas he received in your site. It’s not at all simplistic to just continually be handing out guidance people today may have been selling. So we remember we have got the writer to thank for that. All of the illustrations you have made, the simple website navigation, the relationships your site help instill – it is most extraordinary, and it’s really aiding our son and us believe that the idea is brilliant, and that is highly pressing. Many thanks for everything!

  22. I’ve been surfing on-line more than 3 hours nowadays, but I by no means discovered any interesting
    article like yours. It’s beautiful price enough for me.
    In my opinion, if all web owners and bloggers made good content material as you did, the
    net might be much more useful than ever before.

Leave a Reply

Your email address will not be published. Required fields are marked *