Hi guys (German).
Today I needed to add some real log to something I am developing and I found that SimpleLogger missed those functionalities I was needing. So...I implemented them. It is 3 hours effort, so don't expect too much. But I just wanted to shared with you in case you need it. What I did basically is to define SimpleLogger like the public API. But then, this class delegates to a LoggerStrategy. I created the following implementations: TranscriptLoggerStrategy, NullLoggerStrategy, FileLoggerStrategy and FixesFileNameLoggerStrategy. In addition, I created a superclass for them, marking the API with SimpleLogger. This class is LoggerStrategy. So, now you can: - Enable and disable easily the logging (thanks to NullLoggerStrategy). - Change on runtime WHERE or HOW to log (just change the strategy). - Be able to write into a File, a Transcript, a FixedFileName, or nothing. - Extend to you own strategy (FileAppendLoggerStrategy?? SocketLoggerStrategy? etc...) I did these changes today morning so I didn't have time to write tests nor class comments. However, I wrote some class side example methods in SimpleLogger. Finally, for my own projects I want: - to use a FixedFileName (very similar to the way PharoDebug.log is used). - to only do "self log:" in my classes. The solution I did is that somewhere (maybe in a class of your project or maybe in a special class that holds this) in a class side variable I hold a Singleton with the Logger. So that you can always do for example: MyAppLogger logger log: 'zaraza'. And finally, I implemented Object >> log: (with category *MyAppPackage) log: anObject MyAppLogger logger log: anObject. With this, anywhere in the classes of my app I can do: self log: 'something'. The code is temporally commited in http://www.squeaksource.com/Marea German: if you think I should commit directly to SimpleLogger repo, just let me know. In addition, be completely free to change it as you want and commit it there too. Cheers mariano _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On Thu, Oct 21, 2010 at 12:26 AM, Germán Arduino <[hidden email]> wrote: Thanks you very much Mariano! _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Mariano Martinez Peck
On 20/10/10 9:36 AM, Mariano Martinez Peck wrote:
> What I did basically is to define SimpleLogger like the public API. But > then, this class delegates to a LoggerStrategy. I created the following > implementations: TranscriptLoggerStrategy, NullLoggerStrategy, > FileLoggerStrategy and FixesFileNameLoggerStrategy. In addition, I > created a superclass for them, marking the API with SimpleLogger. This > class is LoggerStrategy. > > So, now you can: > > - Enable and disable easily the logging (thanks to NullLoggerStrategy). > - Change on runtime WHERE or HOW to log (just change the strategy). > - Be able to write into a File, a Transcript, a FixedFileName, or nothing. > - Extend to you own strategy (FileAppendLoggerStrategy?? > SocketLoggerStrategy? etc...) My 2cents. I've not used or looked at SimpleLogger, but recall that it was a single class, plus a metacello config class. The new functionality sounds very useful, but is it still simple. It sounds like it was simple to add extra features - maybe because SimpleLogger was simple. Will the next person who comes along find a similarly simple implementation that can be easily adapted to specific needs. A hierarchy of strategy classes no longer sounds simple. What if I don't need all the different strategies loaded, will the configuration then allow multiple build targets for various individual or groups of strategies. Starting to sound complicated. IMHO, it should be a fork: SomewhatSimpleOnItsWayToComplicatedLogging :) -- Yanni _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Mariano Martinez Peck
why don;t you look look at toothpick?
On Oct 21, 2010, at 3:23 AM, Yanni Chiu wrote: > On 20/10/10 9:36 AM, Mariano Martinez Peck wrote: >> What I did basically is to define SimpleLogger like the public API. But >> then, this class delegates to a LoggerStrategy. I created the following >> implementations: TranscriptLoggerStrategy, NullLoggerStrategy, >> FileLoggerStrategy and FixesFileNameLoggerStrategy. In addition, I >> created a superclass for them, marking the API with SimpleLogger. This >> class is LoggerStrategy. >> >> So, now you can: >> >> - Enable and disable easily the logging (thanks to NullLoggerStrategy). >> - Change on runtime WHERE or HOW to log (just change the strategy). >> - Be able to write into a File, a Transcript, a FixedFileName, or nothing. >> - Extend to you own strategy (FileAppendLoggerStrategy?? >> SocketLoggerStrategy? etc...) > > My 2cents. I've not used or looked at SimpleLogger, but recall that it was a single class, plus a metacello config class. > > The new functionality sounds very useful, but is it still simple. It sounds like it was simple to add extra features - maybe because SimpleLogger was simple. Will the next person who comes along find a similarly simple implementation that can be easily adapted to specific needs. > > A hierarchy of strategy classes no longer sounds simple. What if I don't need all the different strategies loaded, will the configuration then allow multiple build targets for various individual or groups of strategies. Starting to sound complicated. > > IMHO, it should be a fork: SomewhatSimpleOnItsWayToComplicatedLogging :) > > -- > Yanni > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Yanni Chiu
On Thu, Oct 21, 2010 at 3:22 AM, Yanni Chiu <[hidden email]> wrote:
Yes, that's true. However, take a look at the code, and I promisde that in no more than 10 minutes you get the idea how to use it. There are 5 classes, with an average of 5 methods each.
heheheh -- _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Stéphane Ducasse
On Thu, Oct 21, 2010 at 7:24 AM, Stéphane Ducasse <[hidden email]> wrote: why don;t you look look at toothpick? Because I don't have time to learn a new logging framework, nor to make it work on Pharo. I don't plan to be part of a logging framework. I just needed something really EASY for my projects. So, I remembered Germán doing that, I know it was working in Pharo, and it took me 5 minutes to understand. 2 hours more to add my features, and that's all :) I just make it public for other users. Chees Mariano
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Stéphane Ducasse
come on tooth pick has even documentation and it does not look complex.
redoing all over things does not reduce bugs and http://www.metaprog.com/Toothpick/docs/quickstart.html It looks clean and simple. Stef On Oct 21, 2010, at 9:51 AM, Mariano Martinez Peck wrote: > > > On Thu, Oct 21, 2010 at 7:24 AM, Stéphane Ducasse <[hidden email]> wrote: > why don;t you look look at toothpick? > > > Because I don't have time to learn a new logging framework, nor to make it work on Pharo. I don't plan to be part of a logging framework. I just needed something really EASY for my projects. So, I remembered Germán doing that, I know it was working in Pharo, and it took me 5 minutes to understand. 2 hours more to add my features, and that's all :) I just make it public for other users. > > Chees > > Mariano > > > On Oct 21, 2010, at 3:23 AM, Yanni Chiu wrote: > > > On 20/10/10 9:36 AM, Mariano Martinez Peck wrote: > >> What I did basically is to define SimpleLogger like the public API. But > >> then, this class delegates to a LoggerStrategy. I created the following > >> implementations: TranscriptLoggerStrategy, NullLoggerStrategy, > >> FileLoggerStrategy and FixesFileNameLoggerStrategy. In addition, I > >> created a superclass for them, marking the API with SimpleLogger. This > >> class is LoggerStrategy. > >> > >> So, now you can: > >> > >> - Enable and disable easily the logging (thanks to NullLoggerStrategy). > >> - Change on runtime WHERE or HOW to log (just change the strategy). > >> - Be able to write into a File, a Transcript, a FixedFileName, or nothing. > >> - Extend to you own strategy (FileAppendLoggerStrategy?? > >> SocketLoggerStrategy? etc...) > > > > My 2cents. I've not used or looked at SimpleLogger, but recall that it was a single class, plus a metacello config class. > > > > The new functionality sounds very useful, but is it still simple. It sounds like it was simple to add extra features - maybe because SimpleLogger was simple. Will the next person who comes along find a similarly simple implementation that can be easily adapted to specific needs. > > > > A hierarchy of strategy classes no longer sounds simple. What if I don't need all the different strategies loaded, will the configuration then allow multiple build targets for various individual or groups of strategies. Starting to sound complicated. > > > > IMHO, it should be a fork: SomewhatSimpleOnItsWayToComplicatedLogging :) > > > > -- > > Yanni > > > > > > _______________________________________________ > > Pharo-project mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-users mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Mariano Martinez Peck
This was my point when I wrote SimpleLogger, not time to understand
nor port other framework and needed simething really basic. I documented it on Pharo book chapter, we should extend now such chapter with the doc of new features. Cheers. 2010/10/21 Mariano Martinez Peck <[hidden email]>: > > > On Thu, Oct 21, 2010 at 7:24 AM, Stéphane Ducasse > <[hidden email]> wrote: >> >> why don;t you look look at toothpick? >> > > Because I don't have time to learn a new logging framework, nor to make it > work on Pharo. I don't plan to be part of a logging framework. I just needed > something really EASY for my projects. So, I remembered Germán doing that, I > know it was working in Pharo, and it took me 5 minutes to understand. 2 > hours more to add my features, and that's all :) I just make it public for > other users. > > Chees > > Mariano > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Mariano Martinez Peck
and another guy will come and repeat again the same....
sounds to loop here... My point is that why do we extend something that apparently is just done for not been extended else it will be complex and somebody else will restart. Because if toothpick would have been called simpleLogger then may be people would have looked at it the first time. Sorry to be boring this morning but you are wrap in a moebius trick. Tell us when SimpleLogger will not be simple so that we start another simpleloggerBis :) Stef > This was my point when I wrote SimpleLogger, not time to understand > nor port other framework and needed simething really basic. > > I documented it on Pharo book chapter, we should extend now such > chapter with the doc of new features. > > Cheers. > > > 2010/10/21 Mariano Martinez Peck <[hidden email]>: >> >> >> On Thu, Oct 21, 2010 at 7:24 AM, Stéphane Ducasse >> <[hidden email]> wrote: >>> >>> why don;t you look look at toothpick? >>> >> >> Because I don't have time to learn a new logging framework, nor to make it >> work on Pharo. I don't plan to be part of a logging framework. I just needed >> something really EASY for my projects. So, I remembered Germán doing that, I >> know it was working in Pharo, and it took me 5 minutes to understand. 2 >> hours more to add my features, and that's all :) I just make it public for >> other users. >> >> Chees >> >> Mariano >> > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Hi Stef:
2010/10/21 Stéphane Ducasse <[hidden email]>: > and another guy will come and repeat again the same.... > sounds to loop here... > My point is that why do we extend something that apparently is just done for not been extended > else it will be complex and somebody else will restart. > Yes, I understand your point, and was exactly my idea when I wroted (not extend too much). You should ask this question to Mariano :). But I, as I released my original code as MIT, can't negate the access to make derivated versions or so. > Because if toothpick would have been called simpleLogger then may be people would have looked at it the first time. > Sorry to be boring this morning but you are wrap in a moebius trick. > > Tell us when SimpleLogger will not be simple so that we start another simpleloggerBis :) > Stef > But yes, I understand your point. And maybe the Mariano's work is also by the same reasons of my original work, develop my own tools and not have to understand work of others.....Well, life is freedom, I think that anyone can develop whichever code he wants if enjoy doing it :) Cheers. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |