Skip to content
theepicsnail edited this page Jun 14, 2011 · 6 revisions

The LogServer is an optional piece of SuperBot2, that provides a better way to work with the logging system.

Location relative to logs SB2/Logs/*.log SB2/SB2LS/LogServer.py

Usage python LogServer.py Goto the url that outputs.

API

The log server also works as a jsonp api to the logs. For example: http://server:port/?callback=foo

This returns a list of log entries. Each entry contains:

id    0
date  "2011-06-10 10:15:58,477"
pid   107322765797120
level 10
line  ["Foo.py", "myFunc", "123"]
msg   ["First line", "Second line",...]
file  "Exceptions.log.1"

Parameters to the api:

maxid    int     The largest acceptable id (default = -1, up to the latest)
minid    int     The smallest acceptable id (default = 0, the first entry)

## Date format: "2011-06-10 16:11:44,043" (note: it's string comparison) 
before   string  Entries before the given date 
after    string  Entries after the given date 

pid      string  Return only results with this pid

minlevel int     The lowest acceptable logging level (default = 0)    #Note logging levels go:
maxlevel int     The highest acceptable logging level (default = 50)  #debug:10 info,note:20 warning:30
                                                                      #error:40 critical:50
msg      regex  Return only results that match this (Note, at this point lines are joined with tabs.)

file     regex  Only use files that match this (Note: you're matching things like ""Foo.py:myFunc:123"

Intended usage

Last 20 messages global messages from superbot itself

Last 50 messages global messages from superbot itself

IRC specific filters

Last 20 messages from channel #foo

The older 20 of the most recent 40 messages from channel #foo

The older 50 of the most recent 100 messages from channel #foo

The older 50 of the most recent 100 messages from channel #foo by user jdoe

The most recent 20 messages by jdoe in the channel #foo

General fun stats about the channel #foo

General stats about jdoe's activity in the channel #foo