This file is indexed.

/usr/share/doc/lua-logging/us/sql.tpl is in lua-logging 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<div id="content">

<h2>SQL appender</h2>

<p>The SQL appender can be used to write log messages to a SQL
database table. It uses <a href="http://www.keplerproject.org/luasql/">LuaSQL</a>, 
therefore any database supported by LuaSQL can be used.</p>

<pre class="example">
function logging.sql{
    connectionfactory = <i>function</i>,
    [tablename = <i>string</i>,]
    [logdatefield = <i>string</i>,]
    [loglevelfield = <i>string</i>,]
    [logmessagefield = <i>string</i>,]
    [keepalive = <i>boolean</i>],
}
</pre>

<ul>
    <li><code>connectionfactory</code>:<br />
    This must be a function that creates a LuaSQL connection object.
    This function will be called everytime a connection needs to be
    created.</li>
    
    <li><code>tablename</code>:<br />
    The name of the table to write the log requests. Default value is
    <code>"LogTable"</code>.</li>
    
    <li><code>logdatefield</code>:<br />
    The name of the field to write the date of each log request.
    Default value is <code>"LogDate"</code>.</li>
    
    <li><code>loglevelfield</code>:<br />
    The name of the field to write the level of each log request.
    Default value is <code>"LogLevel"</code>.</li>
    
    <li><code>logmessagefield</code>:<br />
    The name of the field to write the message of each log request.
    Default value is <code>"LogMessage"</code>.</li>
    
    <li><code>keepalive</code>:<br />
    In every log request a connection to the database is opened, the
    message is written, and the connection is closed.<br />
    If the user wants to keep the connection opened he can specify
    <code>keepalive = true</code>.</li>
</ul>

<h2>Example</h2>

<pre class="example">
require"logging.sql"
require"luasql.jdbc"

local env, err = luasql.jdbc('com.mysql.jdbc.Driver')

local logger = logging.sql {
  connectionfactory = function()
    local con, err = env:connect('jdbc:mysql://localhost/test',
                                 'tcp', '123')
    assert(con, err)
    return con
  end,
  keepalive = true,
}

logger:info("logging.sql test")
logger:debug("debugging...")
logger:error("error!")
</pre>

</div> <!-- id="content" -->