mhenrixon/sidekiq-unique-jobs

View on GitHub
doc/SidekiqUniqueJobs/Logging.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Module: SidekiqUniqueJobs::Logging
  
    &mdash; Documentation by YARD 0.9.26
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" />

<script type="text/javascript">
  pathId = "SidekiqUniqueJobs::Logging";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (L)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span>
     &raquo; 
    <span class="title">Logging</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Module: SidekiqUniqueJobs::Logging
  
  
  
</h1>
<div class="box_info">
  

  
  
  
  
  

  
  <dl>
    <dt>Included in:</dt>
    <dd><span class='object_link'><a href="BatchDelete.html" title="SidekiqUniqueJobs::BatchDelete (class)">BatchDelete</a></span>, <span class='object_link'><a href="Lock/BaseLock.html" title="SidekiqUniqueJobs::Lock::BaseLock (class)">SidekiqUniqueJobs::Lock::BaseLock</a></span>, <span class='object_link'><a href="LockArgs.html" title="SidekiqUniqueJobs::LockArgs (class)">LockArgs</a></span>, <span class='object_link'><a href="LockDigest.html" title="SidekiqUniqueJobs::LockDigest (class)">LockDigest</a></span>, <span class='object_link'><a href="Locksmith.html" title="SidekiqUniqueJobs::Locksmith (class)">Locksmith</a></span>, <span class='object_link'><a href="Logging/Middleware.html" title="SidekiqUniqueJobs::Logging::Middleware (module)">Middleware</a></span>, <span class='object_link'><a href="OnConflict/Log.html" title="SidekiqUniqueJobs::OnConflict::Log (class)">OnConflict::Log</a></span>, <span class='object_link'><a href="OnConflict/Reschedule.html" title="SidekiqUniqueJobs::OnConflict::Reschedule (class)">OnConflict::Reschedule</a></span>, <span class='object_link'><a href="OnConflict/Strategy.html" title="SidekiqUniqueJobs::OnConflict::Strategy (class)">OnConflict::Strategy</a></span>, <span class='object_link'><a href="Orphans/Observer.html" title="SidekiqUniqueJobs::Orphans::Observer (class)">Orphans::Observer</a></span>, <span class='object_link'><a href="Orphans/Reaper.html" title="SidekiqUniqueJobs::Orphans::Reaper (class)">Orphans::Reaper</a></span>, <span class='object_link'><a href="Redis/Entity.html" title="SidekiqUniqueJobs::Redis::Entity (class)">Redis::Entity</a></span>, <span class='object_link'><a href="UpgradeLocks.html" title="SidekiqUniqueJobs::UpgradeLocks (class)">UpgradeLocks</a></span></dd>
  </dl>
  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/sidekiq_unique_jobs/logging.rb<span class="defines">,<br />
  lib/sidekiq_unique_jobs/logging/middleware_context.rb</span>
</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>Provides the sidekiq middleware that makes the gem work</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Author:</p>
<ul class="author">
  
    <li>
      
      
      
      
        
        <div class='inline'><p>Mikael Henriksson <a href="mailto:mikael@mhenrixon.com">mikael@mhenrixon.com</a></p>
</div>
      
    </li>
  
</ul>

</div><h2>Defined Under Namespace</h2>
<p class="children">
  
    
      <strong class="modules">Modules:</strong> <span class='object_link'><a href="Logging/Middleware.html" title="SidekiqUniqueJobs::Logging::Middleware (module)">Middleware</a></span>
    
  
    
  
</p>







  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#build_message-instance_method" title="#build_message (instance method)">#<strong>build_message</strong>(message_or_exception, item = nil)  &#x21d2; String </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Build a log message.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_debug-instance_method" title="#log_debug (instance method)">#<strong>log_debug</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at debug level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_error-instance_method" title="#log_error (instance method)">#<strong>log_error</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at error level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_fatal-instance_method" title="#log_fatal (instance method)">#<strong>log_fatal</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at fatal level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_info-instance_method" title="#log_info (instance method)">#<strong>log_info</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at info level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#log_warn-instance_method" title="#log_warn (instance method)">#<strong>log_warn</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Logs a message at warn level.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#logger-instance_method" title="#logger (instance method)">#<strong>logger</strong>  &#x21d2; Logger </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A convenience method for using the configured gem logger.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#logging_context-instance_method" title="#logging_context (instance method)">#<strong>logging_context</strong>  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setup some variables to add to each log line.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#with_configured_loggers_context-instance_method" title="#with_configured_loggers_context (instance method)">#<strong>with_configured_loggers_context</strong> { ... } &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Attempt to setup context aware logging for the given logger.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#with_logging_context-instance_method" title="#with_logging_context (instance method)">#<strong>with_logging_context</strong>  &#x21d2; void </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Wraps the middleware logic with context aware logging.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="build_message-instance_method">
  
    #<strong>build_message</strong>(message_or_exception, item = nil)  &#x21d2; <tt>String</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Build a log message</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>an entry to log</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>item</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the sidekiq job hash</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>a complete log entry</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


107
108
109
110
111
112
113
114
115
116
117
118
119
120</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 107</span>

<span class='kw'>def</span> <span class='id identifier rubyid_build_message'>build_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='kw'>return</span> <span class='id identifier rubyid_message_or_exception'>message_or_exception</span> <span class='kw'>if</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>

  <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
  <span class='id identifier rubyid_details'>details</span> <span class='op'>=</span> <span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_slice'>slice</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK-constant" title="SidekiqUniqueJobs::LOCK (constant)">LOCK</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#QUEUE-constant" title="SidekiqUniqueJobs::QUEUE (constant)">QUEUE</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#CLASS-constant" title="SidekiqUniqueJobs::CLASS (constant)">CLASS</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#JID-constant" title="SidekiqUniqueJobs::JID (constant)">JID</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html#LOCK_DIGEST-constant" title="SidekiqUniqueJobs::LOCK_DIGEST (constant)">LOCK_DIGEST</a></span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_memo'>memo</span><span class='op'>|</span>
    <span class='id identifier rubyid_memo'>memo</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> (</span><span class='tstring_end'>&quot;</span></span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_details'>details</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>

  <span class='id identifier rubyid_message'>message</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_debug-instance_method">
  
    #<strong>log_debug</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at debug level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


32
33
34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 32</span>

<span class='kw'>def</span> <span class='id identifier rubyid_log_debug'>log_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_build_message'>build_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_error-instance_method">
  
    #<strong>log_error</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at error level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


77
78
79
80
81</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 77</span>

<span class='kw'>def</span> <span class='id identifier rubyid_log_error'>log_error</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_build_message'>build_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_fatal-instance_method">
  
    #<strong>log_fatal</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at fatal level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


92
93
94
95
96
97</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 92</span>

<span class='kw'>def</span> <span class='id identifier rubyid_log_fatal'>log_fatal</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_build_message'>build_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_fatal'>fatal</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>

  <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_info-instance_method">
  
    #<strong>log_info</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at info level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


47
48
49
50
51</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 47</span>

<span class='kw'>def</span> <span class='id identifier rubyid_log_info'>log_info</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_build_message'>build_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="log_warn-instance_method">
  
    #<strong>log_warn</strong>(message_or_exception = nil, item = nil) {|String, Exception| ... } &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Logs a message at warn level</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>message_or_exception</span>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>the message or exception to log</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>, <tt>Exception</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the message or exception to use for log message</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


62
63
64
65
66</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 62</span>

<span class='kw'>def</span> <span class='id identifier rubyid_log_warn'>log_warn</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_build_message'>build_message</span><span class='lparen'>(</span><span class='id identifier rubyid_message_or_exception'>message_or_exception</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="logger-instance_method">
  
    #<strong>logger</strong>  &#x21d2; <tt>Logger</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>A convenience method for using the configured gem logger</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Logger</tt>)</span>
      
      
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li>SidekiqUniqueJobs#.logger</li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 19</span>

<span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span>
  <span class='const'><span class='object_link'><a href="../SidekiqUniqueJobs.html" title="SidekiqUniqueJobs (module)">SidekiqUniqueJobs</a></span></span><span class='period'>.</span><span class='id identifier rubyid_logger'><span class='object_link'><a href="../SidekiqUniqueJobs.html#logger-class_method" title="SidekiqUniqueJobs.logger (method)">logger</a></span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="logging_context-instance_method">
  
    #<strong>logging_context</strong>  &#x21d2; <tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setup some variables to add to each log line</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="../Hash.html" title="Hash (class)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the context to use for each log line</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>NotImplementedError</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


156
157
158</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 156</span>

<span class='kw'>def</span> <span class='id identifier rubyid_logging_context'>logging_context</span>
  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid___method__'>__method__</span><span class='embexpr_end'>}</span><span class='tstring_content'> needs to be implemented in </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="with_configured_loggers_context-instance_method">
  
    #<strong>with_configured_loggers_context</strong> { ... } &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Attempt to setup context aware logging for the given logger</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yields:</p>
<ul class="yield">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


146
147
148</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 146</span>

<span class='kw'>def</span> <span class='id identifier rubyid_with_configured_loggers_context'>with_configured_loggers_context</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_logger_method'>logger_method</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_logging_context'>logging_context</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="with_logging_context-instance_method">
  
    #<strong>with_logging_context</strong>  &#x21d2; <tt>void</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note returns_void">This method returns an undefined value.</p><p>Wraps the middleware logic with context aware logging</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Yield Returns:</p>
<ul class="yieldreturn">
  
    <li>
      
      
        <span class='type'>(<tt>void</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>yield to the middleware instance</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


130
131
132
133
134
135
136</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/sidekiq_unique_jobs/logging.rb', line 130</span>

<span class='kw'>def</span> <span class='id identifier rubyid_with_logging_context'>with_logging_context</span>
  <span class='id identifier rubyid_with_configured_loggers_context'>with_configured_loggers_context</span> <span class='kw'>do</span>
    <span class='kw'>return</span> <span class='kw'>yield</span>
  <span class='kw'>end</span>

  <span class='kw'>nil</span> <span class='comment'># Need to make sure we don&#39;t return anything here
</span><span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Mon Sep 27 15:29:05 2021 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.26 (ruby-3.0.2).
</div>

    </div>
  </body>
</html>