<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 10/14/2013 02:39 PM, Sönke Ludwig
wrote:<br>
</div>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite">Am
14.10.2013 13:39, schrieb Dicebot:
<br>
<blockquote type="cite">As `std.logger` is still marked as "work
in progress" this thread is
<br>
less formal that typical pre-voting review. Goal is to provide
as much
<br>
input about desirable `std.logger` functionality and current
state and
<br>
let module author to use this information for preparing proposal
for
<br>
actual review / voting.
<br>
<br>
Lets unleash the forces of constructive destruction.
<br>
<br>
===== Meta =====
<br>
<br>
Code:
<a class="moz-txt-link-freetext" href="https://github.com/D-Programming-Language/phobos/pull/1500/files">https://github.com/D-Programming-Language/phobos/pull/1500/files</a>
<br>
Docs:
<a class="moz-txt-link-freetext" href="http://burner.github.io/phobos/phobos-prerelease/std_logger.html">http://burner.github.io/phobos/phobos-prerelease/std_logger.html</a>
<br>
<br>
First announcement / discussion thread :
<br>
<a class="moz-txt-link-freetext" href="http://forum.dlang.org/post/mailman.313.1377180809.1719.digitalmars-d@puremagic.com">http://forum.dlang.org/post/mailman.313.1377180809.1719.digitalmars-d@puremagic.com</a>
<br>
<br>
</blockquote>
<br>
Sorry in advance for the long list of issues. I think the general
approach is fine, but over the years I've grown some preferences
for this stuff. Generally, I think we should make sure that such a
module is flexible enough to fulfill most people's needs, or it
will probably fail the widespread adoption that is desired to
actually improve interoperability.
<br>
<br>
- LogLevel: enum values should start lower case according to the
<br>
Phobos conventions.
<br>
</blockquote>
will be fixed<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
The static methods in LogManager should be made global and the
class
<br>
be removed. It's not for objects so it shouldn't be a class.
<br>
</blockquote>
LogManager also stores the global log level. Sure I can make another
static global function storing this log level, but I would like to
keep them together as they belong together IMO.<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
For me this logger is completely worthless without any debug log
<br>
levels. The last std.log entry had at least anonymous verbosity
<br>
levels, but I'd prefer something like I did in vibe.d [1],
where
<br>
each level has a defined role. This should especially improve
the
<br>
situation when multiple libraries are involved.
<br>
</blockquote>
Logger.log(LogLevel.(d|D)ebug, "Your message");<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
Similarly, I've never felt the need for conditional logging, but
<br>
without it being lazy evaluated what's the use for it,
actually?<br>
</blockquote>
The conditional logging part is totally transparent. <br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
I really think there should be shortcuts for the different log
<br>
levels. Typing out "LogLevel.xxx" each time looks tedious for
<br>
something that is used in so many places.
<br>
</blockquote>
One could argue that writting logger.logDebug("...") is more tedious
than writing,<br>
logger.logLevel = LogLevel.xxx;<br>
logger.log("...");<br>
logger.log("...");<br>
...<br>
<br>
This has been argued in the last logger discussion to some extend
and it looked to me like this is the mostly preferred version.<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
There should be some kind of MultiLogger so that multiple log
<br>
destinations can be configured (e.g. console + file). Or,
instead of
<br>
a single default logger, there could be a list of loggers.
<br>
</blockquote>
there is one default logger. I will create a MultiLogger, good
point. I'm currently sure how to store the multi logger (LL or Array
or ... )<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
Logger.logMessage: Exchanging the bunch of parameters with a
single
<br>
struct that is passed by reference makes the API much more
<br>
flexible/future-proof and is more efficient when the data needs
to
<br>
be passed on to other functions.
<br>
</blockquote>
good point<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
"shared" - probably best to leave this out until we have a
verified
<br>
design for that - but in theory the loggers should probably be
<br>
shared. <br>
</blockquote>
my thoughts
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
exactly
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
On the same topic, if I'm right and the default logger is stored
as
<br>
__gshared, it should be documented that Loggers need to be
<br>
thread-safe.
<br>
</blockquote>
It is not stored __gshared, but If, you're right.<br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
GC allocations for each log message _must_ be avoided at all
costs.
<br>
Using formattedWrite() instead of format() on either a
temporary
<br>
buffer that is reused, or, better, on some kind of output range
<br>
interface of the Logger would solve this.
<br>
</blockquote>
This was proposed in the last thread. A fixed size buffer would
scream bufferoverflow, a dynamic buffer not but both would raise the
question of thread safety. <br>
<blockquote cite="mid:l3gonf$2o25$1@digitalmars.com" type="cite"> -
A note on DDOC comments: The first paragraph of a doc comment is
<br>
treated as a short description according to the DDOC spec. It
should
<br>
be kept to around a single sentence, followed by a more
detailed
<br>
paragraph. While this doesn't matter much with the current HTML
doc
<br>
layout, the short description is used in the single-page
<br>
documentation inside of overview tables [2].
<br>
</blockquote>
Will be fixed<br>
<br>
Awesome comments, thanks<br>
</body>
</html>