Skip to content

Instantly share code, notes, and snippets.

@do-aki
Created March 30, 2012 03:34
Show Gist options
  • Save do-aki/2246245 to your computer and use it in GitHub Desktop.
Save do-aki/2246245 to your computer and use it in GitHub Desktop.
fluent.logger_lua
local logger = require 'fluent.logger'
logger.connect()
logger.post('test.test', {message='data'})
local os = require 'os'
local msgpack = require 'msgpack'
local socket = require 'socket'
module('fluent.logger')
local fluent = nil
function connect(host, port)
fluent = socket.connect(host or '127.0.0.1', port or 24224)
end
function post(tag, data)
local p = msgpack.Packer()
local msg = p:pack({tag, os.time(), data})
fluent:send(msg)
end
function close()
fluent:close()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment