Acme-CPANModulesBundle-Import-PerlDancerAdvent-2018
view release on metacpan or search on metacpan
devdata/http_advent.perldancer.org_2018_17 view on Meta::CPAN
<h2><a name="inline_images"></a>Inline images</h2>
<p>You can simply deliver emails with links to images, but usually email clients would not load them without user interaction.
It is possible though to attached the images to the email and reference them in the email body with a custom HTML tag:</p>
<pre class="prettyprint"> email {
from => 'foo@perl.dance',
to => 'bar@perl.dance',
subject => 'Welcome to the dancefloor!',
body => q{<p>Image embedded: <img src="cid:mycid"/></p>},
type => 'html',
attach => [ { Id => 'mycid', Path => '/dancefloor/dcr-header-logo.png' }],
multipart => 'related'
};</pre>
<h2><a name="providing_plain_text_part"></a>Providing plain text part</h2>
<p><a href="https://metacpan.org/pod/HTML::FormatText::WithLinks">HTML::FormatText::WithLinks</a> makes it easy to provide a plain text version
of your HTML email:</p>
<pre class="prettyprint">my $html = template $template, $tokens, { layout => 'email' };
my $f = HTML::FormatText::WithLinks->new;
devdata/http_advent.perldancer.org_2018_23 view on Meta::CPAN
info: "bold green"
warning: "bold yellow"
error: "bold yellow on_red"
colored_messages:
core: "bold bright_white"
debug: "bold bright_blue"
info: "bold green"
warning: "bold yellow"
error: "bold yellow on_red"</pre>
<img src="/images/2018/23/log-1.png">
<p>The <code>colored_origin</code> refers to the part of the message that shows the package that this
message originated in, as well as the file name and line.</p>
<pre class="prettyprint">>> Dancer2 v0.207000 server 28764 listening on http://0.0.0.0:3000
[main:28764] debug @2018-12-19 20:31:06> Hello World in test.pl l. 6
^^^^ ^^^^^^^ ^</pre>
<p>The <code>colored_levels</code> are the log levels themselves.</p>
<pre class="prettyprint">[main:28764] debug @2018-12-19 20:31:06> Hello World in test.pl l. 6
^^^^^</pre>
devdata/http_advent.perldancer.org_2018_23 view on Meta::CPAN
<pre class="prettyprint"># config.yml
engines:
logger:
Console::Colored:
colored_regex:
- re: "customer number \d+"
color: "bold red"</pre>
<p>This will find customer numbers according to the pattern and make them bold and red. You can supply
a regular expression pattern and a color setting.</p>
<img src="/images/2018/23/log-2.png">
<p>Note that there is a list under the <code>colored_regex</code> key. This means you can actually have
multiple patterns. Even really simple ones that make <code>print</code> style debugging easy
and attractive.</p>
<pre class="prettyprint"># config.yml
engines:
logger:
Console::Colored:
colored_regex:
- re: "customer number \d+"
devdata/http_advent.perldancer.org_2018_23 view on Meta::CPAN
everything. However, this works on the message only, and not on the entire formatted line of log output.
(Patches welcome!)</p>
<pre class="prettyprint"># config.yml
engines:
logger:
Console::Colored:
colored_regex:
- re: ".+here.+"
color: "white on_red"</pre>
<img src="/images/2018/23/log-3.png">
<p>This opens up a lot of possibilities, for debugging as well as for general logging during development.</p>
<h2><a name="what_else"></a>What else?</h2>
<p>There are still some feature ideas in the backlog, but it's already pretty useful. If you would
like to see additional features, please feel free to
[open an issue on github](https://github.com/simbabque/Dancer2-Logger-Console-Colored/issues).</p>
<p>And if you happen to use Mojolicious as well and need something similar, take a look at
<a href="https://metacpan.org/module/Mojo::Log::Colored">Mojo::Log::Colored</a>, which is in the early stages of development, but works quite well.</p>
<h2><a name="author"></a>Author</h2>
( run in 2.156 seconds using v1.01-cache-2.11-cpan-df04353d9ac )