Merge lp:~miguelaraujo/mysql-proxy/loaded-plugins-logging into lp:mysql-proxy/0.8

Proposed by Miguel Araújo
Status: Merged
Approved by: Jan Kneschke
Approved revision: 1230
Merge reported by: Jan Kneschke
Merged at revision: not available
Proposed branch: lp:~miguelaraujo/mysql-proxy/loaded-plugins-logging
Merge into: lp:mysql-proxy/0.8
Diff against target: 73 lines (+24/-5)
4 files modified
plugins/cli/cli-plugin.c (+2/-2)
src/chassis-frontend.c (+14/-0)
src/chassis-frontend.h (+5/-0)
src/mysql-proxy-cli.c (+3/-3)
To merge this branch: bzr merge lp:~miguelaraujo/mysql-proxy/loaded-plugins-logging
Reviewer Review Type Date Requested Status
Jan Kneschke (community) Approve
Review via email: mp+89737@code.launchpad.net

This proposal supersedes a proposal from 2012-01-03.

Description of the change

Updated plugins chassis name value;
Added logging for the loaded plugins.

To post a comment you must log in.
Revision history for this message
Jan Kneschke (jan-kneschke) wrote : Posted in a previous version of this proposal

1) don't prefix all plugin names by "MySQL" when logging. It is up to the plugin to define its full name it wants to announce

2) remove the CHASSIS_NEWLINE from the g_critical() to get rid of the double newline. g_critical() (as all g_log() functions) always adds a newline itself.

review: Needs Fixing
Revision history for this message
Jan Kneschke (jan-kneschke) wrote : Posted in a previous version of this proposal

After a 2nd thought: stick with the old plugin names (proxy, debug, ...) and log it as:

  g_critical("plugin %s %s started", p->name, p->version);

review: Needs Fixing
1230. By Miguel Araújo

Reverted to old plugin names and altered logging message sintax

Revision history for this message
Jan Kneschke (jan-kneschke) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/cli/cli-plugin.c'
2--- plugins/cli/cli-plugin.c 2010-04-06 14:26:51 +0000
3+++ plugins/cli/cli-plugin.c 2012-01-23 20:08:38 +0000
4@@ -556,8 +556,8 @@
5 int plugin_init(chassis_plugin *p) {
6 /* append the our init function to the init-hook-list */
7 p->magic = CHASSIS_PLUGIN_MAGIC;
8- p->name = g_strdup("cli");
9- p->version = g_strdup("0.7.0");
10+ p->name = g_strdup("client");
11+ p->version = g_strdup(PACKAGE_VERSION);
12
13 p->init = network_mysqld_cli_plugin_init;
14 p->get_options = network_mysqld_cli_plugin_get_options;
15
16=== modified file 'src/chassis-frontend.c'
17--- src/chassis-frontend.c 2011-10-13 10:56:04 +0000
18+++ src/chassis-frontend.c 2012-01-23 20:08:38 +0000
19@@ -524,6 +524,20 @@
20 lua_close(L);
21 }
22
23+/**
24+ * log the versions of the initialized plugins
25+*/
26+int chassis_frontend_log_plugin_versions(GPtrArray *plugins) {
27+ guint i;
28+
29+ for (i = 0; i < plugins->len; i++) {
30+ chassis_plugin *p = plugins->pdata[i];
31+
32+ g_critical("plugin %s %s started", p->name, p->version);
33+ }
34+
35+ return 0;
36+}
37
38 int chassis_frontend_write_pidfile(const char *pid_file, GError **gerr) {
39 int fd;
40
41=== modified file 'src/chassis-frontend.h'
42--- src/chassis-frontend.h 2010-07-07 07:57:26 +0000
43+++ src/chassis-frontend.h 2012-01-23 20:08:38 +0000
44@@ -151,6 +151,11 @@
45 CHASSIS_API void chassis_frontend_print_lua_version();
46
47 /**
48+ * log the versions of the initialized plugins
49+*/
50+CHASSIS_API int chassis_frontend_log_plugin_versions(GPtrArray *plugins);
51+
52+/**
53 * write the PID to a file
54 *
55 * @param pid_file name of the PID file
56
57=== modified file 'src/mysql-proxy-cli.c'
58--- src/mysql-proxy-cli.c 2011-09-08 09:13:48 +0000
59+++ src/mysql-proxy-cli.c 2012-01-23 20:08:38 +0000
60@@ -564,10 +564,10 @@
61 }
62 }
63
64- /* the message has to be _after_ the g_option_content_parse() to
65- * hide from the output if the --help is asked for
66+ /*
67+ * log the versions of all loaded plugins
68 */
69- g_message("%s started", PACKAGE_STRING); /* add tag to the logfile (after we opened the logfile) */
70+ chassis_frontend_log_plugin_versions(srv->modules);
71
72 #ifdef _WIN32
73 if (chassis_win32_is_service()) chassis_win32_service_set_state(SERVICE_RUNNING, 0);

Subscribers

People subscribed via source and target branches