210 lines
No EOL
7.1 KiB
HTML
210 lines
No EOL
7.1 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>
|
|
Class: ActiveRecord::LogSubscriber
|
|
|
|
— Documentation by YARD 0.7.1
|
|
|
|
</title>
|
|
|
|
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
|
|
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
relpath = '..';
|
|
if (relpath != '') 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>
|
|
<script type="text/javascript" charset="utf-8">
|
|
if (window.top.frames.main) document.body.className = 'frames';
|
|
</script>
|
|
|
|
<div id="header">
|
|
<div id="menu">
|
|
|
|
<a href="../_index.html">Index (L)</a> »
|
|
<span class='title'><span class='object_link'><a href="../ActiveRecord.html" title="ActiveRecord (module)">ActiveRecord</a></span></span>
|
|
»
|
|
<span class="title">LogSubscriber</span>
|
|
|
|
|
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
</div>
|
|
|
|
<div id="search">
|
|
|
|
<a id="class_list_link" href="#">Class List</a>
|
|
|
|
<a id="method_list_link" href="#">Method List</a>
|
|
|
|
<a id="file_list_link" href="#">File List</a>
|
|
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
<iframe id="search_frame"></iframe>
|
|
|
|
<div id="content"><h1>Class: ActiveRecord::LogSubscriber
|
|
|
|
|
|
|
|
</h1>
|
|
|
|
<dl class="box">
|
|
|
|
<dt class="r1">Inherits:</dt>
|
|
<dd class="r1">
|
|
<span class="inheritName">Object</span>
|
|
|
|
<ul class="fullTree">
|
|
<li>Object</li>
|
|
|
|
<li class="next">ActiveRecord::LogSubscriber</li>
|
|
|
|
</ul>
|
|
<a href="#" class="inheritanceTree">show all</a>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dt class="r2 last">Defined in:</dt>
|
|
<dd class="r2 last">lib/log_overrider.rb</dd>
|
|
|
|
</dl>
|
|
<div class="clear"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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="#sql-instance_method" title="#sql (instance method)">- (Object) <strong>sql</strong>(event) </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<div id="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<p class="signature first" id="sql-instance_method">
|
|
|
|
- (<tt>Object</tt>) <strong>sql</strong>(event)
|
|
|
|
|
|
|
|
</p><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
83
|
|
84
|
|
85
|
|
86
|
|
87
|
|
88
|
|
89
|
|
90
|
|
91
|
|
92
|
|
93
|
|
94
|
|
95
|
|
96
|
|
97
|
|
98
|
|
99
|
|
100
|
|
101</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/log_overrider.rb', line 83</span>
|
|
|
|
<span class='def def kw'>def</span> <span class='sql identifier id'>sql</span><span class='lparen token'>(</span><span class='event identifier id'>event</span><span class='rparen token'>)</span>
|
|
<span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='runtime identifier id'>runtime</span> <span class='opasgn op'>+=</span> <span class='event identifier id'>event</span><span class='dot token'>.</span><span class='duration identifier id'>duration</span>
|
|
<span class='return return kw'>return</span> <span class='unless unless_mod kw'>unless</span> <span class='logger identifier id'>logger</span><span class='dot token'>.</span><span class='info? fid id'>info?</span>
|
|
|
|
<span class='payload identifier id'>payload</span> <span class='assign token'>=</span> <span class='event identifier id'>event</span><span class='dot token'>.</span><span class='payload identifier id'>payload</span>
|
|
<span class='sql identifier id'>sql</span> <span class='assign token'>=</span> <span class='payload identifier id'>payload</span><span class='lbrack token'>[</span><span class='symbol val'>:sql</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='squeeze identifier id'>squeeze</span><span class='lparen token'>(</span><span class='string val'>' '</span><span class='rparen token'>)</span>
|
|
<span class='binds identifier id'>binds</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
|
|
|
|
<span class='unless unless kw'>unless</span> <span class='lparen token'>(</span><span class='payload identifier id'>payload</span><span class='lbrack token'>[</span><span class='symbol val'>:binds</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='empty? fid id'>empty?</span>
|
|
<span class='binds identifier id'>binds</span> <span class='assign token'>=</span> <span class='string val'>" "</span> <span class='plus op'>+</span> <span class='payload identifier id'>payload</span><span class='lbrack token'>[</span><span class='symbol val'>:binds</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='col identifier id'>col</span><span class='comma token'>,</span><span class='v identifier id'>v</span><span class='bitor op'>|</span>
|
|
<span class='lbrack token'>[</span><span class='col identifier id'>col</span><span class='dot token'>.</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='v identifier id'>v</span><span class='rbrack token'>]</span>
|
|
<span class='rbrace token'>}</span><span class='dot token'>.</span><span class='inspect identifier id'>inspect</span>
|
|
<span class='end end kw'>end</span>
|
|
|
|
<span class='log_string identifier id'>log_string</span> <span class='assign token'>=</span> <span class='dstring node'>"event=sql name='#{payload[:name]}' ms=#{event.duration} query='#{sql}'"</span>
|
|
<span class='log_string identifier id'>log_string</span> <span class='lshft op'><<</span> <span class='dstring node'>"caller_hash=#{caller.hash} binds='#{binds}' caller_with_diaspora='#{caller.grep(/diaspora\/(app|lib)/).join(';')}'"</span>
|
|
<span class='info identifier id'>info</span> <span class='log_string identifier id'>log_string</span>
|
|
|
|
<span class='end end kw'>end</span>
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Mon Jun 13 15:59:23 2011 by
|
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
0.7.1 (ruby-1.8.7).
|
|
</div>
|
|
|
|
</body>
|
|
</html> |