[lxc-devel] [PATCH] log: Set log_define properly
Serge Hallyn
serge.hallyn at ubuntu.com
Wed Feb 5 23:16:19 UTC 2014
Quoting Stéphane Graber (stgraber at ubuntu.com):
> This sets lxc_log_define to what should be appropriate values for all
> existing binaries that call lxc_log_init.
>
> The name is lxc_<bin name>_ui for anything that's user visible and
> lxc_<bin name> for anything that's not.
>
> The parent is set to "lxc" for anything using the API and to the
> matching C file name for anything that isn't.
>
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/lxc_autostart.c | 7 +++++++
> src/lxc/lxc_cgroup.c | 2 +-
> src/lxc/lxc_clone.c | 2 +-
> src/lxc/lxc_console.c | 2 +-
> src/lxc/lxc_create.c | 2 +-
> src/lxc/lxc_destroy.c | 2 +-
> src/lxc/lxc_execute.c | 2 +-
> src/lxc/lxc_freeze.c | 2 +-
> src/lxc/lxc_info.c | 2 ++
> src/lxc/lxc_monitor.c | 2 +-
> src/lxc/lxc_snapshot.c | 2 +-
> src/lxc/lxc_start.c | 2 +-
> src/lxc/lxc_stop.c | 2 ++
> src/lxc/lxc_unfreeze.c | 2 +-
> src/lxc/lxc_wait.c | 2 +-
> 15 files changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/src/lxc/lxc_autostart.c b/src/lxc/lxc_autostart.c
> index b03de4f..ed62294 100644
> --- a/src/lxc/lxc_autostart.c
> +++ b/src/lxc/lxc_autostart.c
> @@ -27,6 +27,8 @@
> #include "list.h"
> #include "log.h"
>
> +lxc_log_define(lxc_autostart_ui, lxc);
> +
> static int my_parser(struct lxc_arguments* args, int c, char* arg)
> {
> switch (c) {
> @@ -221,6 +223,11 @@ int main(int argc, char *argv[])
> if (lxc_arguments_parse(&my_args, argc, argv))
> return 1;
>
> + if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
> + my_args.progname, my_args.quiet, my_args.lxcpath[0]))
> + return 1;
> + lxc_log_options_no_override();
> +
> count = list_defined_containers(NULL, NULL, &containers);
>
> if (count < 0)
> diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
> index b7fc621..a3cd2b7 100644
> --- a/src/lxc/lxc_cgroup.c
> +++ b/src/lxc/lxc_cgroup.c
> @@ -32,7 +32,7 @@
> #include "log.h"
> #include "arguments.h"
>
> -lxc_log_define(lxc_cgroup_ui, lxc_cgroup);
> +lxc_log_define(lxc_cgroup_ui, lxc);
>
> static int my_checker(const struct lxc_arguments* args)
> {
> diff --git a/src/lxc/lxc_clone.c b/src/lxc/lxc_clone.c
> index ea2d16f..d7e6bc9 100644
> --- a/src/lxc/lxc_clone.c
> +++ b/src/lxc/lxc_clone.c
> @@ -36,7 +36,7 @@
> #include "conf.h"
> #include "state.h"
>
> -lxc_log_define(lxc_clone, lxc);
> +lxc_log_define(lxc_clone_ui, lxc);
>
> /* we pass fssize in bytes */
> static uint64_t get_fssize(char *s)
> diff --git a/src/lxc/lxc_console.c b/src/lxc/lxc_console.c
> index c262ada..bfee6fb 100644
> --- a/src/lxc/lxc_console.c
> +++ b/src/lxc/lxc_console.c
> @@ -47,7 +47,7 @@
> #include "arguments.h"
> #include "commands.h"
>
> -lxc_log_define(lxc_console_ui, lxc_console);
> +lxc_log_define(lxc_console_ui, lxc);
>
> static char etoc(const char *expr)
> {
> diff --git a/src/lxc/lxc_create.c b/src/lxc/lxc_create.c
> index 87845b4..a3684c1 100644
> --- a/src/lxc/lxc_create.c
> +++ b/src/lxc/lxc_create.c
> @@ -33,7 +33,7 @@
> #include "arguments.h"
> #include "utils.h"
>
> -lxc_log_define(lxc_create, lxc);
> +lxc_log_define(lxc_create_ui, lxc);
>
> static uint64_t get_fssize(char *s)
> {
> diff --git a/src/lxc/lxc_destroy.c b/src/lxc/lxc_destroy.c
> index cd56f08..d8bca34 100644
> --- a/src/lxc/lxc_destroy.c
> +++ b/src/lxc/lxc_destroy.c
> @@ -29,7 +29,7 @@
> #include "arguments.h"
> #include "utils.h"
>
> -lxc_log_define(lxc_destroy, lxc);
> +lxc_log_define(lxc_destroy_ui, lxc);
>
> static int my_parser(struct lxc_arguments* args, int c, char* arg)
> {
> diff --git a/src/lxc/lxc_execute.c b/src/lxc/lxc_execute.c
> index 18baa06..2ba4aeb 100644
> --- a/src/lxc/lxc_execute.c
> +++ b/src/lxc/lxc_execute.c
> @@ -41,7 +41,7 @@
> #include "start.h"
> #include "utils.h"
>
> -lxc_log_define(lxc_execute_ui, lxc_execute);
> +lxc_log_define(lxc_execute_ui, lxc);
>
> static struct lxc_list defines;
>
> diff --git a/src/lxc/lxc_freeze.c b/src/lxc/lxc_freeze.c
> index bb01a3a..fa64963 100644
> --- a/src/lxc/lxc_freeze.c
> +++ b/src/lxc/lxc_freeze.c
> @@ -33,7 +33,7 @@
>
> #include "arguments.h"
>
> -lxc_log_define(lxc_freeze_ui, lxc_cgroup);
> +lxc_log_define(lxc_freeze_ui, lxc);
>
> static const struct option my_longopts[] = {
> LXC_COMMON_OPTIONS
> diff --git a/src/lxc/lxc_info.c b/src/lxc/lxc_info.c
> index b556c2c..96cb966 100644
> --- a/src/lxc/lxc_info.c
> +++ b/src/lxc/lxc_info.c
> @@ -37,6 +37,8 @@
> #include "commands.h"
> #include "arguments.h"
>
> +lxc_log_define(lxc_info_ui, lxc);
> +
> static bool ips;
> static bool state;
> static bool pid;
> diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
> index fa954dc..7e2299a 100644
> --- a/src/lxc/lxc_monitor.c
> +++ b/src/lxc/lxc_monitor.c
> @@ -34,7 +34,7 @@
> #include "monitor.h"
> #include "arguments.h"
>
> -lxc_log_define(lxc_monitor_ui, lxc_monitor);
> +lxc_log_define(lxc_monitor_ui, lxc);
>
> static bool quit_monitord;
>
> diff --git a/src/lxc/lxc_snapshot.c b/src/lxc/lxc_snapshot.c
> index a8d4e7f..75c4223 100644
> --- a/src/lxc/lxc_snapshot.c
> +++ b/src/lxc/lxc_snapshot.c
> @@ -33,7 +33,7 @@
> #include "arguments.h"
> #include "utils.h"
>
> -lxc_log_define(lxc_snapshot, lxc);
> +lxc_log_define(lxc_snapshot_ui, lxc);
>
> static char *newname;
> static char *snapshot;
> diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c
> index 9517fe6..05fb161 100644
> --- a/src/lxc/lxc_start.c
> +++ b/src/lxc/lxc_start.c
> @@ -55,7 +55,7 @@
> #define OPT_SHARE_IPC OPT_USAGE+2
> #define OPT_SHARE_UTS OPT_USAGE+3
>
> -lxc_log_define(lxc_start_ui, lxc_start);
> +lxc_log_define(lxc_start_ui, lxc);
>
> static struct lxc_list defines;
>
> diff --git a/src/lxc/lxc_stop.c b/src/lxc/lxc_stop.c
> index fc9d70a..78a1da2 100644
> --- a/src/lxc/lxc_stop.c
> +++ b/src/lxc/lxc_stop.c
> @@ -36,6 +36,8 @@
> #define OPT_NO_LOCK OPT_USAGE+1
> #define OPT_NO_KILL OPT_USAGE+2
>
> +lxc_log_define(lxc_stop_ui, lxc);
> +
> static int my_parser(struct lxc_arguments* args, int c, char* arg)
> {
> switch (c) {
> diff --git a/src/lxc/lxc_unfreeze.c b/src/lxc/lxc_unfreeze.c
> index e66d165..7371980 100644
> --- a/src/lxc/lxc_unfreeze.c
> +++ b/src/lxc/lxc_unfreeze.c
> @@ -31,7 +31,7 @@
> #include "log.h"
> #include "arguments.h"
>
> -lxc_log_define(lxc_unfreeze_ui, lxc_cgroup);
> +lxc_log_define(lxc_unfreeze_ui, lxc);
>
> static const struct option my_longopts[] = {
> LXC_COMMON_OPTIONS
> diff --git a/src/lxc/lxc_wait.c b/src/lxc/lxc_wait.c
> index d34c5e7..e1010e2 100644
> --- a/src/lxc/lxc_wait.c
> +++ b/src/lxc/lxc_wait.c
> @@ -34,7 +34,7 @@
> #include "log.h"
> #include "arguments.h"
>
> -lxc_log_define(lxc_wait_ui, lxc_monitor);
> +lxc_log_define(lxc_wait_ui, lxc);
>
> static int my_checker(const struct lxc_arguments* args)
> {
> --
> 1.9.rc1
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list