loggingluaopenwrt

Good logging library for Lua


I'm using Lua from OpenWRT based Access Point device to develop some S/W on it.

I want to find a good logging libraries for Lua. Do you have any recommendation? I checked about lsyslog.


Solution

  • I found that lsyslog is good enough for OpenWRT.

    http://luaforge.net/projects/lsyslog/

    I can build it from OpenWRT by using the below feeds Makefile.

    include $(TOPDIR)/rules.mk
    
    PKG_NAME:=lsyslog
    PKG_VERSION:=5
    PKG_RELEASE:=1
    
    PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
    PKG_SOURCE_URL:=http://files.luaforge.net/releases/lsyslog/lsyslog/lsyslog-$(PKG_VERSION)
    
    include $(INCLUDE_DIR)/package.mk
    
    define Package/lsyslog
      SUBMENU:=Lua
      SECTION:=lang
      CATEGORY:=Languages
      TITLE:=lsyslog
      URL:=http://luaforge.net/projects/lsyslog/
      DEPENDS:=+lua 
    endef
    
    define Package/lsyslog/description
      lsyslog is simple binding API from Lua to syslog.
    endef
    
    define Build/Configure
    endef
    
    define Build/Compile
            $(MAKE) -C $(PKG_BUILD_DIR)/ \
                    LIBDIR="$(TARGET_LDFLAGS)" \
                    CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99 -fPIC" \
                    LD="$(TARGET_CROSS)ld -shared" \
                    so
    endef
    
    
    define Package/lsyslog/install
            $(INSTALL_DIR) $(1)/usr/lib/lua
            $(INSTALL_BIN) $(PKG_BUILD_DIR)/syslog.so $(1)/usr/lib/lua
    endef
    
    $(eval $(call BuildPackage,lsyslog))