Added a LOG_PLUGIN macro for plugin output debug messages.
Converted all TRACE messages related to plugins to LOG_PLUGIN.
This commit is contained in:
@@ -41,7 +41,7 @@ static int plugin_command_dispatch(struct command_base* cbase, struct hub_user*
|
||||
struct plugin_user* puser = (struct plugin_user*) user; // FIXME: Use a proper conversion function instead.
|
||||
struct plugin_command* pcommand = (struct plugin_command*) cmd; // FIXME: Use a proper conversion function instead.
|
||||
|
||||
LOG_INFO("plugin_command_dispatch: cmd=%s", cmd->prefix);
|
||||
LOG_PLUGIN("plugin_command_dispatch: cmd=%s", cmd->prefix);
|
||||
|
||||
cmdh = (struct plugin_command_handle*) list_get_first(data->commands);
|
||||
while (cmdh)
|
||||
@@ -59,6 +59,7 @@ static int plugin_command_dispatch(struct command_base* cbase, struct hub_user*
|
||||
|
||||
struct plugin_callback_data* plugin_callback_data_create()
|
||||
{
|
||||
LOG_PLUGIN("plugin_callback_data_create()");
|
||||
struct plugin_callback_data* data = (struct plugin_callback_data*) hub_malloc_zero(sizeof(struct plugin_callback_data));
|
||||
data->commands = list_create();
|
||||
return data;
|
||||
@@ -66,6 +67,7 @@ struct plugin_callback_data* plugin_callback_data_create()
|
||||
|
||||
void plugin_callback_data_destroy(struct plugin_callback_data* data)
|
||||
{
|
||||
LOG_PLUGIN("plugin_callback_data_destroy()");
|
||||
if (data->commands)
|
||||
{
|
||||
uhub_assert(list_size(data->commands) == 0);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "uhub.h"
|
||||
#include "plugin_api/handle.h"
|
||||
|
||||
#define PLUGIN_DEBUG(hub, name) printf("Invoke %s on %d plugins\n",name, (int) (hub->plugins ? list_size(hub->plugins->loaded) : -1));
|
||||
#define PLUGIN_DEBUG(hub, name) LOG_PLUGIN("Invoke %s on %d plugins", name, (int) (hub->plugins ? list_size(hub->plugins->loaded) : -1));
|
||||
|
||||
|
||||
#define INVOKE(HUB, FUNCNAME, CODE) \
|
||||
|
||||
@@ -42,7 +42,7 @@ static struct plugin_hub_internals* get_internals(struct plugin_handle* handle)
|
||||
struct uhub_plugin* plugin_open(const char* filename)
|
||||
{
|
||||
struct uhub_plugin* plugin;
|
||||
LOG_TRACE("plugin_open: \"%s\"", filename);
|
||||
LOG_PLUGIN("plugin_open: \"%s\"", filename);
|
||||
|
||||
plugin = (struct uhub_plugin*) hub_malloc_zero(sizeof(struct uhub_plugin));
|
||||
if (!plugin)
|
||||
@@ -74,8 +74,9 @@ struct uhub_plugin* plugin_open(const char* filename)
|
||||
|
||||
void plugin_close(struct uhub_plugin* plugin)
|
||||
{
|
||||
LOG_TRACE("plugin_close: \"%s\"", plugin->filename);
|
||||
LOG_PLUGIN("plugin_close: \"%s\"", plugin->filename);
|
||||
hub_free(plugin->internals);
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
dlclose(plugin->handle);
|
||||
#else
|
||||
@@ -136,7 +137,7 @@ struct plugin_handle* plugin_load(const char* filename, const char* config, stru
|
||||
if (handle->plugin_api_version == PLUGIN_API_VERSION && handle->plugin_funcs_size == sizeof(struct plugin_funcs))
|
||||
{
|
||||
LOG_INFO("Loaded plugin: %s: %s, version %s.", filename, handle->name, handle->version);
|
||||
LOG_TRACE("Plugin API version: %d (func table size: " PRINTF_SIZE_T ")", handle->plugin_api_version, handle->plugin_funcs_size);
|
||||
LOG_PLUGIN("Plugin API version: %d (func table size: " PRINTF_SIZE_T ")", handle->plugin_api_version, handle->plugin_funcs_size);
|
||||
return handle;
|
||||
}
|
||||
else
|
||||
@@ -193,7 +194,7 @@ static int plugin_parse_line(char* line, int line_count, void* ptr_data)
|
||||
if (!params)
|
||||
params = "";
|
||||
|
||||
LOG_TRACE("Load plugin: \"%s\", params=\"%s\"", soname, params);
|
||||
LOG_PLUGIN("Load plugin: \"%s\", params=\"%s\"", soname, params);
|
||||
plugin = plugin_load(soname, params, hub);
|
||||
if (plugin)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user