mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 08:05:20 +00:00
API: expose function lxc_log_init
Signed-off-by: 0x0916 <w@laoqinren.net>
This commit is contained in:
parent
beda39ebbd
commit
73b910a341
@ -44,6 +44,7 @@
|
||||
#include "log.h"
|
||||
#include "caps.h"
|
||||
#include "utils.h"
|
||||
#include "lxccontainer.h"
|
||||
|
||||
/* We're logging in seconds and nanoseconds. Assuming that the underlying
|
||||
* datatype is currently at maximum a 64bit integer, we have a date string that
|
||||
@ -543,9 +544,7 @@ extern void lxc_log_enable_syslog(void)
|
||||
* Called from lxc front-end programs (like lxc-create, lxc-start) to
|
||||
* initalize the log defaults.
|
||||
*/
|
||||
extern int lxc_log_init(const char *name, const char *file,
|
||||
const char *priority, const char *prefix, int quiet,
|
||||
const char *lxcpath)
|
||||
extern int lxc_log_init(struct lxc_log *log)
|
||||
{
|
||||
int lxc_priority = LXC_LOG_PRIORITY_ERROR;
|
||||
int ret;
|
||||
@ -555,8 +554,8 @@ extern int lxc_log_init(const char *name, const char *file,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (priority)
|
||||
lxc_priority = lxc_log_priority_to_int(priority);
|
||||
if (log->priority)
|
||||
lxc_priority = lxc_log_priority_to_int(log->priority);
|
||||
|
||||
if (!lxc_loglevel_specified) {
|
||||
lxc_log_category_lxc.priority = lxc_priority;
|
||||
@ -564,49 +563,49 @@ extern int lxc_log_init(const char *name, const char *file,
|
||||
}
|
||||
|
||||
if (!lxc_quiet_specified) {
|
||||
if (!quiet)
|
||||
if (!log->quiet)
|
||||
lxc_log_category_lxc.appender->next = &log_appender_stderr;
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
lxc_log_set_prefix(prefix);
|
||||
if (log->prefix)
|
||||
lxc_log_set_prefix(log->prefix);
|
||||
|
||||
if (name)
|
||||
log_vmname = strdup(name);
|
||||
if (log->name)
|
||||
log_vmname = strdup(log->name);
|
||||
|
||||
if (file) {
|
||||
if (strcmp(file, "none") == 0)
|
||||
if (log->file) {
|
||||
if (strcmp(log->file, "none") == 0)
|
||||
return 0;
|
||||
ret = __lxc_log_set_file(file, 1);
|
||||
ret = __lxc_log_set_file(log->file, 1);
|
||||
lxc_log_use_global_fd = 1;
|
||||
} else {
|
||||
/* if no name was specified, there nothing to do */
|
||||
if (!name)
|
||||
if (!log->name)
|
||||
return 0;
|
||||
|
||||
ret = -1;
|
||||
|
||||
if (!lxcpath)
|
||||
lxcpath = LOGPATH;
|
||||
if (!log->lxcpath)
|
||||
log->lxcpath = LOGPATH;
|
||||
|
||||
/* try LOGPATH if lxcpath is the default for the privileged containers */
|
||||
if (!geteuid() && strcmp(LXCPATH, lxcpath) == 0)
|
||||
ret = _lxc_log_set_file(name, NULL, 0);
|
||||
if (!geteuid() && strcmp(LXCPATH, log->lxcpath) == 0)
|
||||
ret = _lxc_log_set_file(log->name, NULL, 0);
|
||||
|
||||
/* try in lxcpath */
|
||||
if (ret < 0)
|
||||
ret = _lxc_log_set_file(name, lxcpath, 1);
|
||||
ret = _lxc_log_set_file(log->name, log->lxcpath, 1);
|
||||
|
||||
/* try LOGPATH in case its writable by the caller */
|
||||
if (ret < 0)
|
||||
ret = _lxc_log_set_file(name, NULL, 0);
|
||||
ret = _lxc_log_set_file(log->name, NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* If !file, that is, if the user did not request this logpath, then
|
||||
* ignore failures and continue logging to console
|
||||
*/
|
||||
if (!file && ret != 0) {
|
||||
if (!log->file && ret != 0) {
|
||||
INFO("Ignoring failure to open default logfile.");
|
||||
ret = 0;
|
||||
}
|
||||
|
@ -348,10 +348,6 @@ ATTR_UNUSED static inline void LXC_##PRIORITY(struct lxc_log_locinfo* locinfo, \
|
||||
|
||||
extern int lxc_log_fd;
|
||||
|
||||
extern int lxc_log_init(const char *name, const char *file,
|
||||
const char *priority, const char *prefix, int quiet,
|
||||
const char *lxcpath);
|
||||
|
||||
extern int lxc_log_set_file(int *fd, const char *fname);
|
||||
extern int lxc_log_syslog(int facility);
|
||||
extern void lxc_log_enable_syslog(void);
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "mainloop.h"
|
||||
#include "monitor.h"
|
||||
#include "utils.h"
|
||||
#include "lxccontainer.h"
|
||||
|
||||
#define CLIENTFDS_CHUNK 64
|
||||
|
||||
@ -350,6 +351,7 @@ int main(int argc, char *argv[])
|
||||
char *lxcpath = argv[1];
|
||||
bool mainloop_opened = false;
|
||||
bool monitord_created = false;
|
||||
struct lxc_log log;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr,
|
||||
@ -364,7 +366,13 @@ int main(int argc, char *argv[])
|
||||
if (ret < 0 || ret >= sizeof(logpath))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
ret = lxc_log_init(NULL, logpath, "DEBUG", "lxc-monitord", 0, lxcpath);
|
||||
log.name = NULL;
|
||||
log.file = logpath;
|
||||
log.priority = "DEBUG";
|
||||
log.prefix = "lxc-monitord";
|
||||
log.quiet = 0;
|
||||
log.lxcpath = lxcpath;
|
||||
ret = lxc_log_init(&log);
|
||||
if (ret)
|
||||
INFO("Failed to open log file %s, log will be lost.", lxcpath);
|
||||
lxc_log_options_no_override();
|
||||
|
@ -1017,6 +1017,22 @@ int list_active_containers(const char *lxcpath, char ***names, struct lxc_contai
|
||||
*/
|
||||
int list_all_containers(const char *lxcpath, char ***names, struct lxc_container ***cret);
|
||||
|
||||
struct lxc_log {
|
||||
const char *name;
|
||||
const char *lxcpath;
|
||||
const char *file;
|
||||
const char *priority;
|
||||
const char *prefix;
|
||||
bool quiet;
|
||||
};
|
||||
|
||||
/*!
|
||||
*\brief Initialize the log
|
||||
*
|
||||
*\param log lxc log configuration.
|
||||
*/
|
||||
int lxc_log_init(struct lxc_log *log);
|
||||
|
||||
/*!
|
||||
* \brief Close log file.
|
||||
*/
|
||||
|
@ -371,6 +371,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = -1, r;
|
||||
int wexit = 0;
|
||||
struct lxc_log log;
|
||||
pid_t pid;
|
||||
lxc_attach_options_t attach_options = LXC_ATTACH_OPTIONS_DEFAULT;
|
||||
lxc_attach_command_t command = (lxc_attach_command_t){.program = NULL};
|
||||
@ -386,8 +387,13 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
r = lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
|
||||
my_args.progname, my_args.quiet, my_args.lxcpath[0]);
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
r = lxc_log_init(&log);
|
||||
if (r)
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
@ -352,12 +352,19 @@ int main(int argc, char *argv[])
|
||||
struct lxc_container **containers = NULL;
|
||||
struct lxc_list **c_groups_lists = NULL;
|
||||
struct lxc_list *cmd_group;
|
||||
struct lxc_log log;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -67,6 +67,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
char *state_object = NULL, *value = NULL;
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(EXIT_FAILURE);
|
||||
@ -74,8 +75,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -234,6 +234,7 @@ static bool restore(struct lxc_container *c)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
bool ret;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
@ -242,8 +243,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
lxc_log_options_no_override();
|
||||
|
@ -98,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
|
||||
ret = lxc_arguments_parse(&my_args, argc, argv);
|
||||
if (ret)
|
||||
@ -106,8 +107,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
ret = lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
|
||||
my_args.progname, my_args.quiet, my_args.lxcpath[0]);
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
ret = lxc_log_init(&log);
|
||||
if (ret)
|
||||
return EXIT_FAILURE;
|
||||
lxc_log_options_no_override();
|
||||
|
@ -169,6 +169,7 @@ static int parse_ovl_mnt(char *mntstring, enum mnttype type);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
int flags = 0;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
@ -178,8 +179,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(ret);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -208,6 +208,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct bdev_specs spec;
|
||||
struct lxc_log log;
|
||||
int flags = 0;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
@ -216,8 +217,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -67,6 +67,7 @@ static bool do_destroy_with_snapshots(struct lxc_container *c);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
bool bret;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
@ -75,8 +76,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
if (my_args.quiet)
|
||||
|
@ -101,6 +101,7 @@ static bool is_interface(const char* dev_name, pid_t pid)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
char *cmd, *dev_name, *dst_name;
|
||||
bool ret = false;
|
||||
|
||||
@ -115,8 +116,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
goto err;
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "config.h"
|
||||
#include "start.h"
|
||||
#include "utils.h"
|
||||
#include "lxccontainer.h"
|
||||
|
||||
lxc_log_define(lxc_execute_ui, lxc);
|
||||
|
||||
@ -106,6 +107,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
char *rcfile;
|
||||
struct lxc_conf *conf;
|
||||
struct lxc_log log;
|
||||
int ret;
|
||||
|
||||
lxc_list_init(&defines);
|
||||
@ -116,8 +118,14 @@ int main(int argc, char *argv[])
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -57,6 +57,7 @@ Options :\n\
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(EXIT_FAILURE);
|
||||
@ -64,8 +65,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -394,6 +394,7 @@ static int print_info(const char *name, const char *lxcpath)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = EXIT_FAILURE;
|
||||
struct lxc_log log;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(ret);
|
||||
@ -401,8 +402,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(ret);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "caps.h"
|
||||
#include "error.h"
|
||||
#include "initutils.h"
|
||||
#include "lxccontainer.h"
|
||||
|
||||
lxc_log_define(lxc_init, lxc);
|
||||
|
||||
@ -83,6 +84,7 @@ int main(int argc, char *argv[])
|
||||
int i, have_status = 0, shutdown = 0;
|
||||
int opt;
|
||||
char *lxcpath = NULL, *name = NULL, *logpriority = NULL;
|
||||
struct lxc_log log;
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "n:l:qP:", options, NULL)) != -1) {
|
||||
switch(opt) {
|
||||
@ -104,8 +106,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
err = lxc_log_init(name, name ? NULL : "none", logpriority,
|
||||
basename(argv[0]), quiet, lxcpath);
|
||||
log.name = name;
|
||||
log.file = name ? NULL : "none";
|
||||
log.priority = logpriority;
|
||||
log.prefix = basename(argv[0]);
|
||||
log.quiet = quiet;
|
||||
log.lxcpath = lxcpath;
|
||||
|
||||
err = lxc_log_init(&log);
|
||||
if (err < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
@ -203,6 +203,7 @@ Options :\n\
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret = EXIT_FAILURE;
|
||||
struct lxc_log log;
|
||||
/*
|
||||
* The lxc parser requires that my_args.name is set. So let's satisfy
|
||||
* that condition by setting a dummy name which is never used.
|
||||
@ -218,8 +219,14 @@ int main(int argc, char *argv[])
|
||||
* We set the first argument that usually takes my_args.name to NULL so
|
||||
* that the log is only used when the user specifies a file.
|
||||
*/
|
||||
if (lxc_log_init(NULL, my_args.log_file, my_args.log_priority,
|
||||
my_args.progname, my_args.quiet, my_args.lxcpath[0]))
|
||||
log.name = NULL;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "log.h"
|
||||
#include "monitor.h"
|
||||
#include "arguments.h"
|
||||
#include "lxccontainer.h"
|
||||
|
||||
lxc_log_define(lxc_monitor_ui, lxc);
|
||||
|
||||
@ -91,6 +92,7 @@ int main(int argc, char *argv[])
|
||||
struct pollfd *fds;
|
||||
nfds_t nfds;
|
||||
int len, rc_main, rc_snp, i;
|
||||
struct lxc_log log;
|
||||
|
||||
rc_main = EXIT_FAILURE;
|
||||
|
||||
@ -100,8 +102,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(rc_main);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -81,6 +81,7 @@ static void print_file(char *path);
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
int ret;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
@ -89,8 +90,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -205,6 +205,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int err = EXIT_FAILURE;
|
||||
struct lxc_conf *conf;
|
||||
struct lxc_log log;
|
||||
char *const *args;
|
||||
char *rcfile = NULL;
|
||||
char *const default_args[] = {
|
||||
@ -226,8 +227,14 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
args = my_args.argv;
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(err);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -155,14 +155,21 @@ out:
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
bool s;
|
||||
int ret = EXIT_FAILURE;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(ret);
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(ret);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -55,6 +55,7 @@ Options :\n\
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(EXIT_FAILURE);
|
||||
@ -62,8 +63,15 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
@ -83,6 +83,7 @@ Options :\n\
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lxc_container *c;
|
||||
struct lxc_log log;
|
||||
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
exit(EXIT_FAILURE);
|
||||
@ -90,8 +91,14 @@ int main(int argc, char *argv[])
|
||||
if (!my_args.log_file)
|
||||
my_args.log_file = "none";
|
||||
|
||||
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]))
|
||||
log.name = my_args.name;
|
||||
log.file = my_args.log_file;
|
||||
log.priority = my_args.log_priority;
|
||||
log.prefix = my_args.progname;
|
||||
log.quiet = my_args.quiet;
|
||||
log.lxcpath = my_args.lxcpath[0];
|
||||
|
||||
if (lxc_log_init(&log))
|
||||
exit(EXIT_FAILURE);
|
||||
lxc_log_options_no_override();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user