Jump to page: 1 27  
Page
Thread overview
std.logger
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Johannes Pfau
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Craig Dillabaugh
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Craig Dillabaugh
Aug 22, 2013
Craig Dillabaugh
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Craig Dillabaugh
Aug 22, 2013
Jacob Carlborg
Aug 22, 2013
Robert Schadek
Aug 22, 2013
David Nadlinger
Aug 22, 2013
Jonathan M Davis
Aug 24, 2013
SomeDude
Aug 24, 2013
Jonathan M Davis
Aug 24, 2013
Robert Schadek
Aug 22, 2013
Craig Dillabaugh
Aug 22, 2013
BS
Aug 22, 2013
Jacob Carlborg
Aug 22, 2013
Robert Schadek
Aug 22, 2013
ilya-stromberg
Sep 07, 2013
Robert Schadek
Aug 22, 2013
develop32
Aug 22, 2013
Jacob Carlborg
Aug 22, 2013
evilrat
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Johannes Pfau
Aug 22, 2013
Robert Schadek
Aug 22, 2013
Johannes Pfau
Aug 22, 2013
Robert Schadek
Aug 23, 2013
Piotr Szturmaj
Aug 23, 2013
Robert Schadek
Aug 23, 2013
Piotr Szturmaj
Aug 23, 2013
Robert Schadek
Aug 23, 2013
growler
Aug 23, 2013
Robert Schadek
Aug 23, 2013
growler
Aug 23, 2013
Piotr Szturmaj
Aug 23, 2013
Robert Schadek
Aug 23, 2013
Piotr Szturmaj
Aug 23, 2013
Robert Schadek
Aug 23, 2013
Gambler
Aug 23, 2013
Robert Schadek
Aug 24, 2013
Robert Schadek
Aug 23, 2013
H. S. Teoh
Aug 25, 2013
Dicebot
Aug 23, 2013
Gary Willoughby
Aug 23, 2013
Robert Schadek
Aug 23, 2013
Gary Willoughby
Aug 23, 2013
Robert Schadek
Aug 23, 2013
Jonathan M Davis
Aug 23, 2013
Johannes Pfau
Aug 23, 2013
Jonathan M Davis
Aug 23, 2013
Johannes Pfau
Aug 23, 2013
Robert Schadek
Aug 23, 2013
H. S. Teoh
Aug 23, 2013
Jacob Carlborg
Aug 23, 2013
Robert Schadek
Sep 07, 2013
Volcz
August 22, 2013
I'm still missing a logging facility in D and as the last attempt seam
to have stopped I want to throw
in my version. After reading through the std.log thread I made my
conclusions and created my own
logger. People seamed to be unhappy with the naming and the way of
configuration.
Additionally when to throw or not to throw seamed to be an argument.

My attempt is to provide a very small functional interface to logging.
IMO it is impossible to fulfill
all requirements a D developer can have through configuration classes
and such, I designed the
a abstract Logger class that can be easily implemented to one's own needs.

As a quick start feature I created a Stdio- and File-Logger. If no
Logger is provided to the log
function a defaultLogger will be used.

Docu: http://burner.github.io/phobos/phobos-prerelease/std_logger.html

Pull Request: https://github.com/D-Programming-Language/phobos/pull/1500


I hope this will lead to some progress in phobos, when it comes to message logging.


August 22, 2013
Am Thu, 22 Aug 2013 16:00:06 +0200
schrieb Robert Schadek <realburner@gmx.de>:

> I'm still missing a logging facility in D and as the last attempt seam
> to have stopped I want to throw
> in my version. After reading through the std.log thread I made my
> conclusions and created my own
> logger. People seamed to be unhappy with the naming and the way of
> configuration.
> Additionally when to throw or not to throw seamed to be an argument.
> 
> My attempt is to provide a very small functional interface to logging.
> IMO it is impossible to fulfill
> all requirements a D developer can have through configuration classes
> and such, I designed the
> a abstract Logger class that can be easily implemented to one's own
> needs.
> 
> As a quick start feature I created a Stdio- and File-Logger. If no
> Logger is provided to the log
> function a defaultLogger will be used.
> 
> Docu: http://burner.github.io/phobos/phobos-prerelease/std_logger.html
> 
> Pull Request: https://github.com/D-Programming-Language/phobos/pull/1500
> 
> 
> I hope this will lead to some progress in phobos, when it comes to message logging.
> 

It would be nice to finally have logging in phobos.
Two small nit-picks:

The API doesn't follow the phobos naming conventions: functions (error, fatal, ...) need to start with a lowercase letter. Same for enum members. See http://dlang.org/dstyle.html

I guess the function string for writeLogMsg is fully-qualified? I'd like to see module and function split into two parts. Or fully-qualified function + module so the fully qualified function name can be sliced to strip the module name: auto fn = func[module.length .. $]
August 22, 2013
On 08/22/2013 05:06 PM, Johannes Pfau wrote:
> It would be nice to finally have logging in phobos.
> Two small nit-picks:
>
> The API doesn't follow the phobos naming conventions: functions (error, fatal, ...) need to start with a lowercase letter. Same for enum members. See http://dlang.org/dstyle.html
I know. I did this because with the last logger, people where complaining that log, info, warning ... where to common names. I'm very open for suggestion here. lowercase or otherwise.
> I guess the function string for writeLogMsg is fully-qualified? I'd like to see module and function split into two parts. Or fully-qualified function + module so the fully qualified function name can be sliced to strip the module name: auto fn = func[module.length .. $]
This is what is done inside of StdIOLogger and FileLogger. I did not
want to do this splitting in Logger.logMessage
as the user could rewrite that to fit its need. Maybe I can add two
static method that return the modulename and the function name.

August 22, 2013
On Thursday, 22 August 2013 at 15:17:16 UTC, Robert Schadek wrote:
> On 08/22/2013 05:06 PM, Johannes Pfau wrote:
>> It would be nice to finally have logging in phobos.
>> Two small nit-picks:
>>
>> The API doesn't follow the phobos naming conventions: functions (error,
>> fatal, ...) need to start with a lowercase letter. Same for enum
>> members. See http://dlang.org/dstyle.html
> I know. I did this because with the last logger, people where
> complaining that log, info, warning ... where to common names.
> I'm very open for suggestion here. lowercase or otherwise.

Would logWarning(), logInfo(), logError() work?  You already have
a logMessage() in there.

It might be a bit redundant in some instances ( Logger.logError()
), but in other cases it be clearer (eg.,  logError("Oh no!
Something went wrong!").

Craig

August 22, 2013
On 08/22/2013 05:32 PM, Craig Dillabaugh wrote:
> On Thursday, 22 August 2013 at 15:17:16 UTC, Robert Schadek wrote:
>> On 08/22/2013 05:06 PM, Johannes Pfau wrote:
>>> It would be nice to finally have logging in phobos.
>>> Two small nit-picks:
>>>
>>> The API doesn't follow the phobos naming conventions: functions (error, fatal, ...) need to start with a lowercase letter. Same for enum members. See http://dlang.org/dstyle.html
>> I know. I did this because with the last logger, people where complaining that log, info, warning ... where to common names. I'm very open for suggestion here. lowercase or otherwise.
>
> Would logWarning(), logInfo(), logError() work?  You already have
> a logMessage() in there.
>
> It might be a bit redundant in some instances ( Logger.logError()
> ), but in other cases it be clearer (eg.,  logError("Oh no!
> Something went wrong!").
>
logMessage is meant to do the actual logging. And IMO it is to much to long. But keep the ideas coming there must be a sweet spot somewhere.

August 22, 2013
On 08/22/2013 05:38 PM, Robert Schadek wrote:
> logMessage is meant to do the actual logging. And IMO it is to much to long. But keep the ideas coming there must be a sweet spot somewhere.
>
sry, logMessage is meant to figure out if the LogLevel of the message
makes it worthy to be printed
and to disable the logging via version(DisableLogger).

writeLogMsg does the actual logging
August 22, 2013
On Thursday, 22 August 2013 at 15:41:40 UTC, Robert Schadek wrote:
> On 08/22/2013 05:38 PM, Robert Schadek wrote:
>> logMessage is meant to do the actual logging. And IMO it is to much to long.
>> But keep the ideas coming there must be a sweet spot somewhere.
>>
> sry, logMessage is meant to figure out if the LogLevel of the message
> makes it worthy to be printed
> and to disable the logging via version(DisableLogger).
>
> writeLogMsg does the actual logging

Do you really find the three extra characters a big problem.

Log() vs. logLog()  //OK, that is kind of ugly.
Info() vs logInfo()
Warning() vs logWarning()
Error() vs logError()

Its only three extra characters and they are all in the sweet
spot on my QWERTY keyboard :o)

I guess my concern would be that if you want to use camelCase and
start with a lower case letter, there are not a tonne of options.
August 22, 2013
On 2013-08-22 17:17, Robert Schadek wrote:

> I know. I did this because with the last logger, people where
> complaining that log, info, warning ... where to common names.
> I'm very open for suggestion here. lowercase or otherwise.

My suggestion is you define a single function "log". This returns an instance of the current/default logger. The logger, be it a struct or class, have one method for each logging level. The default logging level would use opCall, resulting in this API:

log("asd"); // log with default level
log.warning("foo"); // log with warning level
log.error("asd"); //

And so on. Then you would only have one function at the module level.

-- 
/Jacob Carlborg
August 22, 2013
On Thursday, 22 August 2013 at 15:51:53 UTC, Craig Dillabaugh
wrote:
> On Thursday, 22 August 2013 at 15:41:40 UTC, Robert Schadek wrote:
>> On 08/22/2013 05:38 PM, Robert Schadek wrote:
>>> logMessage is meant to do the actual logging. And IMO it is to much to long.
>>> But keep the ideas coming there must be a sweet spot somewhere.
>>>
>> sry, logMessage is meant to figure out if the LogLevel of the message
>> makes it worthy to be printed
>> and to disable the logging via version(DisableLogger).
>>
>> writeLogMsg does the actual logging
>
> Do you really find the three extra characters a big problem.
>
> Log() vs. logLog()  //OK, that is kind of ugly.
> Info() vs logInfo()
> Warning() vs logWarning()
> Error() vs logError()
>
> Its only three extra characters and they are all in the sweet
> spot on my QWERTY keyboard :o)
>
> I guess my concern would be that if you want to use camelCase and
> start with a lower case letter, there are not a tonne of options.

One other advantage of this naming convention is that when the
plain logging fuctions are used:

Critical("I don't like your naming convention!");

vs.

logCritical("Yeah, well yours isn't any better.");

It is a bit more obvious in the 2nd case what is happening (IMO
anyway, or imoAnyway).
August 22, 2013
On Thursday, 22 August 2013 at 14:13:29 UTC, Robert Schadek wrote:
> I'm still missing a logging facility in D and as the last attempt seam
> to have stopped I want to throw
> in my version. After reading through the std.log thread I made my
> conclusions and created my own
> logger. People seamed to be unhappy with the naming and the way of
> configuration.
> Additionally when to throw or not to throw seamed to be an argument.
>
> My attempt is to provide a very small functional interface to logging.
> IMO it is impossible to fulfill
> all requirements a D developer can have through configuration classes
> and such, I designed the
> a abstract Logger class that can be easily implemented to one's own needs.
>
> As a quick start feature I created a Stdio- and File-Logger. If no
> Logger is provided to the log
> function a defaultLogger will be used.
>
> Docu:
> http://burner.github.io/phobos/phobos-prerelease/std_logger.html
>
> Pull Request:
> https://github.com/D-Programming-Language/phobos/pull/1500
>
>
> I hope this will lead to some progress in phobos, when it comes to
> message logging.

Why logging functions accept only a string? I would expect it to behave as std.stdio with its variadic parameters.

It would be more straightforward to write logging code:

log("Moving ", data, " to ", destination);

Where 'data' and 'destination' are any variables. I use such setup in my projects and it helps greatly to identify what went wrong when not using a debugger.

« First   ‹ Prev
1 2 3 4 5 6 7