[4104] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [barnowl/barnowl] Defer failed log messages (#109)

daemon@ATHENA.MIT.EDU (Jason Gross)
Sat Aug 5 22:31:10 2017

Date: Sun, 06 Aug 2017 02:31:08 +0000 (UTC)
From: Jason Gross <notifications@github.com>
Reply-To: barnowl/barnowl <reply+004448c9554f301304ca477f119c5af7f4e92cbc64eaffac92cf00000001159e416c92a169ce009427d1@reply.github.com>
To: barnowl/barnowl <barnowl@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
In-Reply-To: <barnowl/barnowl/pull/109@github.com>

----==_mimepart_59867f6cbe996_65693fab33f13c2c51259
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

JasonGross commented on this pull request.



> +
+sub _register_variables {
+    my $flush_logs_interval = -1;
+    my $flush_logs_timer;
+    BarnOwl::new_variable_full('flush-logs-interval',
+        {
+            default        => -1,
+            summary        => 'how often should logs be flushed, in minutes',
+            description    => "If this is set to a positive value n, deferred logs \n"
+                            . "are flushed every n minutes.  If set to a negative or \n"
+                            . "zero values, deferred logs are only flushed when the \n"
+                            . "command :flush-logs is used.",
+            get_tostring   => sub { "$flush_logs_interval" },
+            set_fromstring => sub {
+                die "Expected integer" unless $_[0] =~ /^-?[0-9]+$/;
+                $flush_logs_interval = 0 + $_[0];

Yes, but I think it may not be necessary here, because Perl implicitly casts.  I've removed it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/barnowl/barnowl/pull/109#discussion_r131533227
----==_mimepart_59867f6cbe996_65693fab33f13c2c51259
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p><b>@JasonGross</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/barnowl/barnowl/pull/109#discussion_r131533227">perl/lib/BarnOwl/DeferredLogging.pm</a>:</p>
<pre style='color:#555'>&gt; +
+sub _register_variables {
+    my $flush_logs_interval = -1;
+    my $flush_logs_timer;
+    BarnOwl::new_variable_full(&#39;flush-logs-interval&#39;,
+        {
+            default        =&gt; -1,
+            summary        =&gt; &#39;how often should logs be flushed, in minutes&#39;,
+            description    =&gt; &quot;If this is set to a positive value n, deferred logs \n&quot;
+                            . &quot;are flushed every n minutes.  If set to a negative or \n&quot;
+                            . &quot;zero values, deferred logs are only flushed when the \n&quot;
+                            . &quot;command :flush-logs is used.&quot;,
+            get_tostring   =&gt; sub { &quot;$flush_logs_interval&quot; },
+            set_fromstring =&gt; sub {
+                die &quot;Expected integer&quot; unless $_[0] =~ /^-?[0-9]+$/;
+                $flush_logs_interval = 0 + $_[0];
</pre>
<p>Yes, but I think it may not be necessary here, because Perl implicitly casts.  I've removed it.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/barnowl/barnowl/pull/109#discussion_r131533227">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AERIyeIbFwXx_PfWpssB3gNwDA1XrQcLks5sVSVsgaJpZM4AWArI">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AERIyQsjeNg1Z_4DuRuKicNsdV6L9887ks5sVSVsgaJpZM4AWArI.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/barnowl/barnowl/pull/109#discussion_r131533227"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/barnowl/barnowl","title":"barnowl/barnowl","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/barnowl/barnowl"}},"updates":{"snippets":[{"icon":"PERSON","message":"@JasonGross commented on #109"}],"action":{"name":"View Pull Request","url":"https://github.com/barnowl/barnowl/pull/109#discussion_r131533227"}}}</script>
----==_mimepart_59867f6cbe996_65693fab33f13c2c51259--

home help back first fref pref prev next nref lref last post