<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 6, 2014 at 2:44 PM, Lennart Hengstmengel <span dir="ltr"><<a href="mailto:lennart@tevreden.nl" target="_blank">lennart@tevreden.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br></blockquote><div><br></div><div>Hey.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I'm using Dancer2 in a RESTful JSON API. Works like a charm. Made everything so much easier! :)<br></blockquote><div><br></div><div>Happy to hear! :) </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Now I needed to implement some logging, and I noticed that the documentation describes some placeholders that haven't been implemented yet, like %h (host emitting the request) and %{header}h (value of a request header).<br>
<br>
I really needed those two so I cloned the repo and implemented these myself, which was quite easy. I'll push the changes and create a pull request.</blockquote><div><br></div><div>First let me thank you for putting the time on this. Well done!</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> But I have some questions:<br>
<br>
- According to the docs, the (not yet implemented) placeholder %i should give the "request id". I'm not sure what that should be? Some kind of session id or something?<br></blockquote><div><br></div><div>The Request ID (will be available as "id" method in the next release) is documented as:</div><div><br></div><div><div>The ID of the request. This allows you to trace a specific request in loggers, per the string created using "to_string".</div><div><br></div><div>The ID of the request is essentially the number of requests run in the current class.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
- lib/Dancer2/Core/Role/Logger.<u></u>pm:74 :<br>
$level = sprintf( '%5s', $level );<br>
Here $level is padded with spaces if it's shorter than 5 chars. So "info" gets an extra space. I'm not sure about the rationale, as "warning" has 7 chars so this line seems a bit pointless. (And the extra space before "info" makes my OCD play up ;))<br></blockquote><div><br></div><div>OCD++</div><div><br></div><div>Go for it!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
- lib/Dancer2/Core/Role/Logger.<u></u>pm:83 :<br>
return "[" . strftime( $block, localtime(time) ) . "]";<br>
Why is the custom formatted time/date enclosed in brackets? Wouldn't it be better to do that in the log_format config directive if you wanted to?<br></blockquote><div><br></div><div>Makes sense, yup.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Obviously I'm hesitant to change the behaviour of these last two things as that may break stuff (like log parsers)...<br></blockquote><div><br></div><div>I'm not aware of any log parsers for the Dancer2 logs. It's also not an official format (unlike the common log format in Apache), so I wouldn't worry.</div><div><br></div><div>Submit the PR and let's check it out.</div><div><br></div><div>All the best,</div><div>Sawyer.</div></div></div></div>