Debian Codegraph @

docs/socket.html

raw ◀ ▶
1 Debian patch touch this file
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <title>LuaLogging: A simple API to use logging features in Lua</title>
6 <link rel="stylesheet" href="doc.css" type="text/css"/>
7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
8 </head>
9 <body>
10
11 <div id="container">
12
13 <div id="product">
14 <div id="product_logo">
15 <img alt="LuaLogging logo" src="images/lualogging-128.png"/>
16 </div>
17 <div id="product_name"><big><strong>LuaLogging</strong></big></div>
18 <div id="product_description">A simple API to use logging features in Lua.</div>
19 </div> <!-- id="product" -->
20
21 <div id="main">
22
23 <div id="navigation">
24 <h1>LuaLogging</h1>
25 <ul>
26 <li><a href="index.html">Home</a></li>
27 <li><a href="manual.html">Manual</a>
28 <ul>
29 <li><a href="manual.html#installation">Installation</a></li>
30 <li><a href="manual.html#logger">Logger objects</a></li>
31 <li><a href="manual.html#examples">Examples</a></li>
32 </ul>
33 </li>
34 <li><a href="manual.html#appenders">Appenders</a>
35 <ul>
36 <li><a href="console.html">Console</a></li>
37 <li><a href="file.html">File</a></li>
38 <li><a href="rolling_file.html">Rolling File</a></li>
39 <li><a href="sql.html">SQL</a></li>
40 <li><strong>Socket</strong></li>
41 <li><a href="rsyslog.html">Rsyslog</a></li>
42 <li><a href="email.html">Email</a></li>
43 <li><a href="nginx.html">Nginx</a></li>
44 </ul>
45 </li>
46 <li><a href="https://github.com/lunarmodules/lualogging">Project</a></li>
47 <li><a href="license.html">License</a></li>
48 </ul>
49 </div> <!-- id="navigation" -->
50
51 <div id="content">
52
53 <h2>Socket appender</h2>
54
55 This appender can be used to send log requests through a socket.
56 Socket appender relies on <a href=
57 "https://www.tecgraf.puc-rio.br/luasocket">LuaSocket</a> to do its
58 job.<br />
59 Upon each log request a connection is opened, the message is sent
60 and the connection is closed.
61
62 <pre class="example">
63 function logging.socket {
64 hostname = <i>string</i>,
65 port = <i>number</i>,
66
67 [logPattern = <i>string</i>,]
68 [logPatterns = {
69 [logging.DEBUG = <i>string</i>,]
70 [logging.INFO = <i>string</i>,]
71 [logging.WARN = <i>string</i>,]
72 [logging.ERROR = <i>string</i>,]
73 [logging.FATAL = <i>string</i>,]
74 },]
75 [timestampPattern = <i>string</i>,]
76 [logLevel = <i>log-level-constant</i>,]
77 }
78 </pre>
79
80 <ul>
81 <li><code>hostname</code>:<br />
82 Hostname can be an IP address or a host name of the server where the log
83 message will be sent.</li>
84
85 <li><code>port</code>:<br />
86 The port must be an integer number in the range [1..64K).</li>
87
88 <li><code>logPatterns</code>:<br />
89 A table with logPattern strings indexed by the log-levels.
90 A logPattern specifies how the message is written.<br />
91 If this parameter is omitted, a patterns table will be created with the
92 parameter <code>logPattern</code> as the default value for each log-level.
93 If <code>logPattern</code> also is omitted then each level will fall back to
94 the current default setting, see <code>logging.defaultLogPatterns</code>.
95 </li>
96
97 <li><code>logPattern</code>:<br />
98 This value will be used as the default value for each log-level that was
99 omitted in <code>logPatterns</code>.
100 </li>
101
102 <li><code>timestampPattern</code>:<br />
103 This is an optional parameter that can be used to specify a date/time formatting
104 in the log message.
105 See <code>logging.date</code> for the format.
106 The default is taken from <code>logging.defaultTimestampPattern()</code>.</li>
107
108 <li><code>logLevel</code>:<br />
109 The initial log-level to set for the created logger.</li>
110 </ul>
111
112 <h2>Example</h2>
113
114 <pre class="example">
115 require"logging.socket"
116
117 local logger = logging.socket {
118 hostname = "localhost",
119 port = 5000,
120 }
121
122 logger:info("logging.socket test")
123 logger:debug("debugging...")
124 logger:error("error!")
125 </pre>
126
127 <p>&nbsp;</p>
128 <p>&nbsp;</p>
129 <p>&nbsp;</p>
130 <p>&nbsp;</p>
131
132 </div> <!-- id="content" -->
133
134 </div> <!-- id="main" -->
135
136 <div id="about">
137 </div> <!-- id="about" -->
138
139 </div> <!-- id="container" -->
140
141 </body>
142 </html>