WL#2940: plugin service: error reporting

Affects: Server-5.6   —   Status: Complete

Plugin should be able to report an error and specify the error message for it
Tasks that this WL should solve:

1. Plugin should be able to report an error of with an arbitrary error message
in an arbitrary place. It'll go into SHOW WARNINGS (plugin will specify a
severity). The server will probably wrap it as "got an error 'XXXX' from plugin
'YYY'". After a discussion with Davi we decided to move this out into a separate 
service.

2. Plugin should be able to write an arbitrary text to the error log, with
specified severity, a server will probably wrap it as ... (see above).

3. As a part of this WL a clear guidelines should be written to explain when and
how a plugin should use each of the error reporting mechanisms - when a method
#1 and when #2. After a discussion with Davi this is obsolete.
New types
---------

The following enumeration type is introduced:

  enum plugin_log_level
  {
    MY_ERROR_LEVEL,
    MY_WARNING_LEVEL,
    MY_INFORMATION_LEVEL
  }; 

The following service structure is introduced:

struct error_reporting_service
{
  int (*log_message)(void *, enum plugin_log_level, const char *, va_list);
} *error_reporting_service;


New functions
-------------

The following new functions are introduced:

  int my_plugin_log_message(void *plugin, enum plugin_log_level level,
                            const char *format, ...);

my_plugin_log_message() will call error_log_print() wrapping up the message with 
the following format string : "Plugin %.*s reported message %s".