126 lines
4.0 KiB
HTML
Executable File
126 lines
4.0 KiB
HTML
Executable File
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<title>LuaLogging: A simple API to use logging features in Lua</title>
|
|
<link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="product">
|
|
<div id="product_logo"><a href="http://www.keplerproject.org">
|
|
<img alt="LuaLogging logo" src="images/lualogging-128.png"/>
|
|
</a></div>
|
|
<div id="product_name"><big><strong>LuaLogging</strong></big></div>
|
|
<div id="product_description">A simple API to use logging features in Lua. <a href="br/">Portuguese version.</a></div>
|
|
</div> <!-- id="product" -->
|
|
|
|
<div id="main">
|
|
|
|
<div id="navigation">
|
|
<h1>LuaLogging</h1>
|
|
<ul>
|
|
<li><a href="index.html">Home</a>
|
|
<ul>
|
|
<li><a href="index.html#overview">Overview</a></li>
|
|
<li><a href="index.html#status">Status</a></li>
|
|
<li><a href="index.html#download">Download</a></li>
|
|
<li><a href="index.html#dependencies">Dependencies</a></li>
|
|
<li><a href="index.html#history">History</a></li>
|
|
<li><a href="index.html#credits">Credits</a></li>
|
|
<li><a href="index.html#contact">Contact</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="manual.html">Manual</a>
|
|
<ul>
|
|
<li><a href="manual.html#introduction">Introduction</a></li>
|
|
<li><a href="manual.html#installation">Installation</a></li>
|
|
<li><a href="manual.html#logger">Logger objects</a></li>
|
|
<li><a href="manual.html#examples">Examples</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="manual.html#appenders">Appenders</a>
|
|
<ul>
|
|
<li><a href="console.html">Console</a></li>
|
|
<li><strong>File</strong></li>
|
|
<li><a href="rolling_file.html">Rolling File</a></li>
|
|
<li><a href="sql.html">SQL</a></li>
|
|
<li><a href="socket.html">Socket</a></li>
|
|
<li><a href="email.html">Email</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="https://github.com/Neopallium/lualogging">Project</a>
|
|
<ul>
|
|
<li><a href="https://github.com/Neopallium/lualogging/issues">Bug Tracker</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="license.html">License</a></li>
|
|
</ul>
|
|
</div> <!-- id="navigation" -->
|
|
|
|
<div id="content">
|
|
|
|
<h2>File appender</h2>
|
|
|
|
<p>The file appender can be used to write log messages to a file. It
|
|
uses Lua I/O routines to do its job.</p>
|
|
|
|
<pre class="example">
|
|
function logging.file(filename, [datePattern], [logPattern])
|
|
</pre>
|
|
|
|
<ul>
|
|
<li><code>filename</code>:<br />
|
|
The name of the file to be written to. On each call to log a
|
|
message the file is opened for appending and closed immediately.<br />
|
|
If the file cannot be opened for appending the logging request
|
|
returns nil and an error message.</li>
|
|
|
|
<li><code>datePattern</code>:<br />
|
|
This is an optional parameter that can be used to specify a date
|
|
pattern that will be passed to the
|
|
<a href="http://www.lua.org/manual/5.0/manual.html#libiosys"><code>os.date</code></a>
|
|
function to compose the filename.<br />
|
|
This is useful to create daily or monthly log files. If the user
|
|
wants to create one log file per day he specifies a
|
|
<code>"%Y-%m-%d"</code> pattern and a filename like
|
|
<code>"temp%s.log"</code>.</li>
|
|
|
|
<li><code>logPattern</code>:<br />
|
|
A pattern can be specified to control how the message is
|
|
written.<br />
|
|
The default value is <code>"%date %level %message\n"</code>.</li>
|
|
</ul>
|
|
|
|
<h2>Example</h2>
|
|
|
|
<pre class="example">
|
|
require"logging.file"
|
|
|
|
local logger = logging.file("test%s.log", "%Y-%m-%d")
|
|
|
|
logger:info("logging.file test")
|
|
logger:debug("debugging...")
|
|
logger:error("error!")
|
|
</pre>
|
|
|
|
<p> </p>
|
|
<p> </p>
|
|
|
|
</div> <!-- id="content" -->
|
|
|
|
</div> <!-- id="main" -->
|
|
|
|
<div id="about">
|
|
<p><a href="http://validator.w3.org/check?uri=referer">
|
|
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 válido!" height="31" width="88" /></a></p>
|
|
</div> <!-- id="about" -->
|
|
|
|
</div> <!-- id="container" -->
|
|
|
|
</body>
|
|
</html>
|