Skip to content

Simple IRC logger with web interface written in Common Lisp

License

Notifications You must be signed in to change notification settings

vladimir-g/zoglog

Repository files navigation

ZOGLOG - simple IRC logger with web interface

This is a simple IRC logger with web interface implemented in Common Lisp that can log multiple channels on different servers. Web interface served via Hunchentoot, logs stored in PostgreSQL using Postmodern library.

ZOGLOG was tested on SBCL and Clozure CL, but may work on other Lisp implementations.

Install

PostgreSQL and Common Lisp are required.

Put the source code to the place where ASDF could find it, then install required dependencies for zoglog package (with Quicklisp or similar tool). Create PostgreSQL database. Tables and indexes will be created automatically on first start.

Installing PostgresSQL trigram extension is recommended for performance (run CREATE EXTENSION pg_trgm; in postgres shell, must be done under superuser account).

Copy config.lisp.example somewhere and edit it.

Usage

Use start function to start logger and web interface:

(start "/path/to/config.lisp")

Config file path is optional, app will use config.lisp from the source directory by default.

Stop all services with stop function:

(stop)

Application starts one thread per IRC server (described in config) and a web interface server (listening all addresses on port 4242 by default).

Logging and web interface also could be managed separately using other functions, even in runtime (with Swank for example).

Reference

start and stop used to start and stop logger and web interface respectively.

Running logger threads stored in the *logger-instances* hash table, where key is the server name from the config and value is the thread instance.

start-logging-thread (server-name &optional server-conf)
starts logging thread for one server in the config file, designated by the alist key in :servers and adds thread to *logger-instances*. Custom server configuration may be provided as server-conf Example:
;; Start with config from config file 
(start-logging-thread 'freenode-logger)

;; Start with custom config
(start-logging-thread 'other-logger 
                      '(:server "localhost"
                        :port 6667
                        :nick "test"
                        :channels ("test1" "test2")))
stop-logging-thread (server-name)
stops thread by it’s key and removes thread from *logger-instances*. Example:
(stop-logging-thread 'freenode-logger)
start-web (&optional (port 4242) address)
starts web interface.
stop-web ()
stops web interface.
start-logging (&optional (servers (getf config :servers))
starts logging for all servers from the config. Custom config also may be provided as argument. Same effect can be achieved by executing start-logging-thread for each server separately.
stop-logging ()
stops all running logger threads.
log-server (&key server port nick channels username password extra-commands encoding socket-timeout tls options)
start logging for one server in current thread. Default encoding is UTF-8. If tls is provided, SSL/TLS connection will be used. If username and password are provided, SASL authentication will be used. Parameter options is the list of symbols representing additional tuning parameters. Currently one option is available - send-on-connect - it forces server to join and send extra commands without waiting to the end of MOTD. Example usage:
(log-server :server "irc.freenode.net"
            :port 6667
            :nick "logger"
            :channels '("channel1" "channel2")
            :extra-commands '("PRIVMSG NickServ :IDENTIFY somepassword")
            :encoding :utf-8)

Tests

Some tests reside in zoglog-test system. They can be run by invoking ASDF test-system:

(asdf:test-system :zoglog)

Or run tests directly:

(zoglog-test:run-tests)

About

ZOGLOG was made just for fun, it’s code isn’t very good and not fully tested, use it on your own risk (or don’t use at all).

Name comes from popular conspiracy theories (and jokes) about all-seeing ZOG, don’t take it seriously. Author doesn’t think that real ZOG exists but that is his problem.

License

This app released under MIT license (see LICENSE file)

About

Simple IRC logger with web interface written in Common Lisp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published