Skip to content

For make the old version object-oriented #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Modification
============
Modified to an object-oriented socket that one can create multiple socket object for different server connection
Modified by whuben(https://github.com/whuben)

Motivation of Modification
==========================
The old version `resty.socket.lua`(written by Jiale Zhi (calio), CloudFlare Inc) is not support for multiple syslog server, if you want to send different log message to different remote server, you should make copies of the socket with different name and requrie them in the code, one copy just supports for one remote server.
So, just make it objective-oriented for supporting multiple syslog server

Usage for creating multipul socket objects
==========================================
```
local socket = require "lib.resty.socket"
--create two socket objects for remote log server A and B
local socket_obj_a = socket:init(syslog_config_a) --syslog_config_a is the config info of remote log server A
local socket_obj_b = socket:init(syslog_config_b) --syslog_config_b is the config info of remote log server B
--send msg to remote log server
socket_obj_a:log(msg_a.."\n") --send message msg_a to remote log server A
socket_obj_b:log(msg_b.."\n") --send message msg_b to remote log server B
```

Name
====

Expand Down
Loading