summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormoteus <mimir@newmail.ru>2013-12-26 15:34:58 +0400
committermoteus <mimir@newmail.ru>2013-12-26 15:34:58 +0400
commit5982fd74baad6cdee2c536203afe6c435a2d02e9 (patch)
treee8b7e667ab4160ad95e9409bc7bd826e69fbc9ff /README.md
parent92ec624951de2d344b28eb5262a3534822f6d6a7 (diff)
downloadlua-llthreads2-5982fd74baad6cdee2c536203afe6c435a2d02e9.tar.gz
lua-llthreads2-5982fd74baad6cdee2c536203afe6c435a2d02e9.tar.bz2
lua-llthreads2-5982fd74baad6cdee2c536203afe6c435a2d02e9.zip
Add. set_logger function allow logging errors (crash Lua VM) in current llthread's threads.
``` Lua local llthreads = require "llthreads" local LOG = require"log".new( require "log.writer.net.zmq".new("tcp://127.0.0.1:5555") ) llthread.set_logger(function(msg) LOG.error(msg) end) ```
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md
index c0b67bf..3721b90 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,26 @@ This is full dropin replacement for [llthreads](https://github.com/Neopallium/lu
15##Additional 15##Additional
16* thread:join() method support zero timeout to check if thread alive 16* thread:join() method support zero timeout to check if thread alive
17* thread:join() method support arbitrary timeout on Windows platform 17* thread:join() method support arbitrary timeout on Windows platform
18* set_logger function allow logging errors (crash Lua VM) in current llthread's threads
18 19
19[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/moteus/lua-llthreads2/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 20[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/moteus/lua-llthreads2/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
20 21
22
23##Usage
24
25### Use custom logger
26In this example I use [lua-log](https://github.com/moteus/lua-log) library.
27``` Lua
28-- This is child thread.
29local llthreads = require "llthreads"
30-- Send logs using ZMQ
31local LOG = require"log".new(
32 require "log.writer.net.zmq".new("tcp://127.0.0.1:5555")
33)
34llthread.set_logger(function(msg) LOG.error(msg) end)
35
36...
37
38-- This error with traceback will be passed to logger
39error("SOME ERROR")
40```