Skip to content

Latest commit

 

History

History
129 lines (103 loc) · 5.51 KB

File metadata and controls

129 lines (103 loc) · 5.51 KB

Classes

ParserEventEmitter

Typedefs

ParserRegexps : Object

Hash containing regular expressions (or strings convertible to RegExps) to use for scanning log lines. All properties are optional, and will default to regular expressions which match against irssi's default log format.

ParserOptions : Object

Options recognized by the Parser constructor.

RemovableListener : Object

Object containing a remove method for unhooking itself.

Parser ⇐ EventEmitter

Kind: global class
Extends: EventEmitter

new Parser(options)

Creates a new Parser with the specified options.

Param Type Description
options ParserOptions Options to apply to the Parser instance

parser.parse(filename)

Parses the given log file.

Kind: instance method of Parser

Param Type Description
filename string File to parse

parser.pause()

Pauses parsing after the currently-read chunk. This means that it might not pause right after the current line, but it will before the file is read any further. Additional calls to this function when already paused do nothing.

Kind: instance method of Parser

parser.resume()

Causes the previous parse to continue where it left off.

Kind: instance method of Parser

parser.onAll(handler) ⇒ RemovableListener

Binds a function to all emitted events.

Kind: instance method of Parser

Param Type Description
handler function The handler to fire on every processed log message

ParserRegexps : Object

Hash containing regular expressions (or strings convertible to RegExps) to use for scanning log lines. All properties are optional, and will default to regular expressions which match against irssi's default log format.

Kind: global typedef
Properties

Name Type Description
logopen string | RegExp "Log opened" message; $1 = date+time
logclose string | RegExp "Log closed" message; $1 = date+time
daychange string | RegExp "Day changed" message; $1 = date+time; Note that these lines will not emit events
timestamp string | RegExp Timestamp (prefixes all other message types listed below)
join string | RegExp "X has joined" message; $1 = nick, $2 = mask
part string | RegExp "X has left" message; $1 = nick, $2 = mask, $3 = message
quit string | RegExp "X has quit" message; $1 = nick, $2 = mask, $3 = message
kick string | RegExp "X was kicked" message; $1 = nick, $2 = kicker, $3 = message
nick string | RegExp "X is now known as Y" message; $1 = old nick, $2 = new nick
ownNick string | RegExp "You're now known as X" message; $1 = new nick
nicks string | RegExp "Total of ..." message; $1 = total, $2 = ops, $3 = halfops, $4 = voices, $5 = normal
mode string | RegExp "mode ... by X" message; $1 = modes, $2 = moder
message string | RegExp Normal message; $1 = mode, $2 = nick, $3 = message
action string | RegExp Action (i.e. the /me command); $1 = nick, $2 = message

ParserOptions : Object

Options recognized by the Parser constructor.

Kind: global typedef
Properties

Name Type Description
defaultNick string Default initial nick to use for the logging client's own nick changes, in case it cannot be discerned automatically from logopen + join + names messages
debug boolean Flag which will cause unhandled log lines to be output to stderr
regexps Object.<string, ParserRegexps> Custom regular expressions to override the defaults; useful to handle custom log message formats

RemovableListener : Object

Object containing a remove method for unhooking itself.

Kind: global typedef
Properties

Name Type Description
remove function Method that can be called to unhook the listener