Files
falco/userspace/digwatch/formats.h
Henri DF 1c04ed7874 rework digwatch event output handling
the high-level change is that events matching a rule are now send into a
lua "on_event" function for handling, rather than doing the handling
down in c++.

more specifics:

before, the lua "load_rule" function registered formatters with
associated IDs with the c++ side, which later used this state to
reconcile events with formats and print output accordingly.

now, no such state is kept on the c++ side. the lua "load_rule" function
maintains the id->formatters map, and uses it to print outputs when it
receives events.

this change simplifies the existing flow and will also make the forthcoming
implementation of function outputs far simpler than it would have been
in the current setup.
2016-02-28 21:06:29 -08:00

22 lines
396 B
C++

#pragma once
#include "sinsp.h"
#include "lua_parser.h"
class sinsp_evt_formatter;
class digwatch_formats
{
public:
digwatch_formats(sinsp* inspector, lua_State *ls);
// formatter = digwatch.formatter(format_string)
static int formatter(lua_State *ls);
// formatted_string = digwatch.format_event(evt, formatter)
static int format_event(lua_State *ls);
private:
lua_State* m_ls;
};