www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Logger for D

reply sybrandy <sybrandy gmail.com> writes:
Hello,

I just wanted to let everyone know that I created a simple logging 
library for D.  I wrote it as I wanted to debug my programs without 
having to deal with standard output and have used it for several little 
coding adventures.

https://launchpad.net/dlogger

The main features are:

- Supports trace, info, dbug (debug), error, and fatal log errors.
- Logging levels can be changed while the program is running
- Is thread safe (hopefully)
- If compiled with -version=nologger, it's like you never included it.

Besides satisfying my own needs, I felt that a logging library of some 
sort would be good for Phobos, hence why I'm making this available.

Please report any issues/suggestions to the launchpad site.

Enjoy!

Casey
May 11 2010
next sibling parent reply novice2 <sorry noem.ail> writes:
sybrandy Wrote:

 
 https://launchpad.net/dlogger

thank you! but why site says "DLogger does not have any download files." ?
 - If compiled with -version=nologger, it's like you never included it.

may be it would be better -version=logger to compile with logger, and normal - without? what do you think? imho, compile with logger - not normal situation? i can be wrong of course...
May 12 2010
parent sybrandy <sybrandy gmail.com> writes:
On 05/12/2010 11:57 AM, novice2 wrote:
 sybrandy Wrote:

 https://launchpad.net/dlogger

thank you!

You're welcome!
 but why site says "DLogger does not have any download files." ?

Got me. I think it's because I don't have any "releases" yet.
 - If compiled with -version=nologger, it's like you never included it.

may be it would be better -version=logger to compile with logger, and normal - without? what do you think? imho, compile with logger - not normal situation? i can be wrong of course...

If that's the case, that's fine with me. It's not a huge change to the code. Based on recent experience, I prefer having a logger in unless I explicitly say I don't want it. It's great for debugging apps when you don't want to annoy your user with the details or if it's a server. Casey
May 12 2010
prev sibling next sibling parent reply strtr <strtr spam.com> writes:
sybrandy Wrote:

 Hello,
 
 I just wanted to let everyone know that I created a simple logging 
 library for D.  I wrote it as I wanted to debug my programs without 
 having to deal with standard output and have used it for several little 
 coding adventures.
 
 https://launchpad.net/dlogger
 
 The main features are:
 
 - Supports trace, info, dbug (debug), error, and fatal log errors.
 - Logging levels can be changed while the program is running
 - Is thread safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.
 
 Besides satisfying my own needs, I felt that a logging library of some 
 sort would be good for Phobos, hence why I'm making this available.
 
 Please report any issues/suggestions to the launchpad site.
 
 Enjoy!
 
 Casey

I'm pro a std.log (for D1 as well :) but shouldn't this be in .announce ?
May 12 2010
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
strtr wrote:
 sybrandy Wrote:
 
 Hello,

 I just wanted to let everyone know that I created a simple logging 
 library for D.  I wrote it as I wanted to debug my programs without 
 having to deal with standard output and have used it for several little 
 coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors.
 - Logging levels can be changed while the program is running
 - Is thread safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.

 Besides satisfying my own needs, I felt that a logging library of some 
 sort would be good for Phobos, hence why I'm making this available.

 Please report any issues/suggestions to the launchpad site.

 Enjoy!

 Casey

I'm pro a std.log (for D1 as well :) but shouldn't this be in .announce ?

Me too, but unfortunately the logger is using std.stream, which I think needs replacement. Andrei
May 12 2010
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Graham Fawcett wrote:
 Hi Andrei,
 
 On Wed, 12 May 2010 09:43:00 -0700, Andrei Alexandrescu wrote:
 
 strtr wrote:
 sybrandy Wrote:

 Hello,

 I just wanted to let everyone know that I created a simple logging
 library for D.  I wrote it as I wanted to debug my programs without
 having to deal with standard output and have used it for several
 little coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors. -
 Logging levels can be changed while the program is running - Is thread
 safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.

 Besides satisfying my own needs, I felt that a logging library of some
 sort would be good for Phobos, hence why I'm making this available.

 Please report any issues/suggestions to the launchpad site.

 Enjoy!

 Casey

but shouldn't this be in .announce ?

needs replacement.

Comments like this make me nervous. :) How much of the stdlib do you think needs replacement? Which if any modules should be considered stable? Can D2 users expect that the stdlib in a year's time will look anything like it does now? Is there a formal development plan? I appreciate that D2 and its Phobos are works in progress. But I would hope that a statement like "std.stream needs replacement," coming from a core developer, would be followed up with either a replacement plan or a rationale and a call-to-arms. Noblesse oblige! Perhaps the D2 stdlib documentation should remind prominently that the stdlib isn't actually standardized yet, and that it should be treated as an experimental library. Best, Graham

I understand. The word about std.stream has been out for a long time, and there is no similarly large overhaul planned to other parts of Phobos. For the logger interface, I think it's enough to use an output stream interface with only void put(in char[]) defined. Andrei
May 12 2010
next sibling parent sybrandy <sybrandy gmail.com> writes:
 For the logger interface, I think it's enough to use an output stream
 interface with only void put(in char[]) defined.


 Andrei

Specifically, do you mean that I should be doing all my writes using a wrapper around std.file? I just want to make sure that I do it right this time. I went with std.stream as I felt that buffered output would minimize the performance impact of writing out the file system and since it was there...well... Regardless, if that is the case, then that's fine. If I'm missing something, I'd like to know before I go down the wrong road again. Thanks. Casey
May 12 2010
prev sibling parent Don <nospam nospam.com> writes:
Andrei Alexandrescu wrote:
 Graham Fawcett wrote:
 Hi Andrei,

 On Wed, 12 May 2010 09:43:00 -0700, Andrei Alexandrescu wrote:

 strtr wrote:
 sybrandy Wrote:

 Hello,

 I just wanted to let everyone know that I created a simple logging
 library for D.  I wrote it as I wanted to debug my programs without
 having to deal with standard output and have used it for several
 little coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors. -
 Logging levels can be changed while the program is running - Is thread
 safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.

 Besides satisfying my own needs, I felt that a logging library of some
 sort would be good for Phobos, hence why I'm making this available.

 Please report any issues/suggestions to the launchpad site.

 Enjoy!

 Casey

but shouldn't this be in .announce ?

needs replacement.

Comments like this make me nervous. :) How much of the stdlib do you think needs replacement? Which if any modules should be considered stable? Can D2 users expect that the stdlib in a year's time will look anything like it does now? Is there a formal development plan? I appreciate that D2 and its Phobos are works in progress. But I would hope that a statement like "std.stream needs replacement," coming from a core developer, would be followed up with either a replacement plan or a rationale and a call-to-arms. Noblesse oblige! Perhaps the D2 stdlib documentation should remind prominently that the stdlib isn't actually standardized yet, and that it should be treated as an experimental library. Best, Graham

I understand. The word about std.stream has been out for a long time, and there is no similarly large overhaul planned to other parts of Phobos.

But there is a large number of modules scheduled for deprecation (std.boxer, for example). I really like the idea of having a STATUS statement displayed at the top of the docs for every module.
May 13 2010
prev sibling next sibling parent Graham Fawcett <fawcett uwindsor.ca> writes:
Hi Andrei,

On Wed, 12 May 2010 09:43:00 -0700, Andrei Alexandrescu wrote:

 strtr wrote:
 sybrandy Wrote:
 
 Hello,

 I just wanted to let everyone know that I created a simple logging
 library for D.  I wrote it as I wanted to debug my programs without
 having to deal with standard output and have used it for several
 little coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors. -
 Logging levels can be changed while the program is running - Is thread
 safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.

 Besides satisfying my own needs, I felt that a logging library of some
 sort would be good for Phobos, hence why I'm making this available.

 Please report any issues/suggestions to the launchpad site.

 Enjoy!

 Casey

I'm pro a std.log (for D1 as well :) but shouldn't this be in .announce ?

Me too, but unfortunately the logger is using std.stream, which I think needs replacement.

Comments like this make me nervous. :) How much of the stdlib do you think needs replacement? Which if any modules should be considered stable? Can D2 users expect that the stdlib in a year's time will look anything like it does now? Is there a formal development plan? I appreciate that D2 and its Phobos are works in progress. But I would hope that a statement like "std.stream needs replacement," coming from a core developer, would be followed up with either a replacement plan or a rationale and a call-to-arms. Noblesse oblige! Perhaps the D2 stdlib documentation should remind prominently that the stdlib isn't actually standardized yet, and that it should be treated as an experimental library. Best, Graham
May 12 2010
prev sibling parent Graham Fawcett <fawcett uwindsor.ca> writes:
On Wed, 12 May 2010 13:22:28 -0700, Andrei Alexandrescu wrote:

 Graham Fawcett wrote:
 Hi Andrei,
 
 On Wed, 12 May 2010 09:43:00 -0700, Andrei Alexandrescu wrote:
 
 strtr wrote:
 sybrandy Wrote:

 Hello,

 I just wanted to let everyone know that I created a simple logging
 library for D.  I wrote it as I wanted to debug my programs without
 having to deal with standard output and have used it for several
 little coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors. -
 Logging levels can be changed while the program is running - Is
 thread safe (hopefully)
 - If compiled with -version=nologger, it's like you never included
 it.

 Besides satisfying my own needs, I felt that a logging library of
 some sort would be good for Phobos, hence why I'm making this
 available.

 Please report any issues/suggestions to the launchpad site.

 Enjoy!

 Casey

but shouldn't this be in .announce ?

think needs replacement.

Comments like this make me nervous. :) How much of the stdlib do you think needs replacement? Which if any modules should be considered stable? Can D2 users expect that the stdlib in a year's time will look anything like it does now? Is there a formal development plan? I appreciate that D2 and its Phobos are works in progress. But I would hope that a statement like "std.stream needs replacement," coming from a core developer, would be followed up with either a replacement plan or a rationale and a call-to-arms. Noblesse oblige! Perhaps the D2 stdlib documentation should remind prominently that the stdlib isn't actually standardized yet, and that it should be treated as an experimental library. Best, Graham

I understand. The word about std.stream has been out for a long time, and there is no similarly large overhaul planned to other parts of Phobos.

Thank you. I'm fairly new here, and was not aware of the ongoing discussion about std.stream. Best, Graham
 For the logger interface, I think it's enough to use an output stream
 interface with only void put(in char[]) defined.
 
 
 Andrei

May 12 2010
prev sibling parent reply "Masahiro Nakagawa" <repeatedly gmail.com> writes:
Hi,

On Wed, 12 May 2010 07:54:23 +0900, sybrandy <sybrandy gmail.com> wrote:

 Hello,

 I just wanted to let everyone know that I created a simple logging  
 library for D.  I wrote it as I wanted to debug my programs without  
 having to deal with standard output and have used it for several little  
 coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors.
 - Logging levels can be changed while the program is running
 - Is thread safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.

 Besides satisfying my own needs, I felt that a logging library of some  
 sort would be good for Phobos, hence why I'm making this available.

 Please report any issues/suggestions to the launchpad site.

I want two features. - file-size or time-based rotation Manual management is very bother. - filter I think message customization is useful(e.g. coloring for terminal). Some loggers support this functionality(Log4j, Boost.log, etc...). I once wrote a logger. My logger is here. http://www.bitbucket.org/repeatedly/scrap/src/tip/logger.d This logger supports above features(Rotation is file-size only). Hope this helps.
May 13 2010
parent sybrandy <sybrandy gmail.com> writes:
On 05/13/2010 04:05 PM, Masahiro Nakagawa wrote:
 Hi,
 
 On Wed, 12 May 2010 07:54:23 +0900, sybrandy <sybrandy gmail.com> wrote:
 
 Hello,

 I just wanted to let everyone know that I created a simple logging 
 library for D. I wrote it as I wanted to debug my programs without 
 having to deal with standard output and have used it for several 
 little coding adventures.

 https://launchpad.net/dlogger

 The main features are:

 - Supports trace, info, dbug (debug), error, and fatal log errors.
 - Logging levels can be changed while the program is running
 - Is thread safe (hopefully)
 - If compiled with -version=nologger, it's like you never included it.

 Besides satisfying my own needs, I felt that a logging library of some 
 sort would be good for Phobos, hence why I'm making this available.

 Please report any issues/suggestions to the launchpad site.

I want two features. - file-size or time-based rotation Manual management is very bother. - filter I think message customization is useful(e.g. coloring for terminal). Some loggers support this functionality(Log4j, Boost.log, etc...). I once wrote a logger. My logger is here. http://www.bitbucket.org/repeatedly/scrap/src/tip/logger.d This logger supports above features(Rotation is file-size only). Hope this helps.

Cool. I'll keep that in mind as I try to improve it. Currently, it just overwrites the file every run, however my use case was programs that run til completion, so that was perfectly acceptable. Granted, I've been toying with some server code, but even then I don't have it running very long. I first need to focus on replacing std.stream for writing to the logfile. Thanks. Casey
May 14 2010