5 /* Authors: Martin Quinson */
6 /* Copyright (C) 2003 the OURAGAN project. */
8 /* This program is free software; you can redistribute it and/or modify it
9 under the terms of the license (GNU LGPL) which comes with this package. */
11 #include "gras_private.h"
13 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,GRAS);
15 extern void gras_log_exit(void);
21 gras_module_new_fct_t new;
22 gras_module_finalize_fct_t finalize;
26 gras_init(int *argc, char **argv) {
27 gras_init_defaultlog(argc, argv, NULL);
31 * gras_init_defaultlog:
35 * Initialize the gras mecanisms.
38 gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
44 INFO0("Initialize GRAS");
46 /** Set logs and init log submodule */
47 for (i=1; i<*argc; i++) {
48 if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
50 opt=strchr(argv[i],'=');
52 TRYFAIL(gras_log_control_set(opt));
53 DEBUG1("Did apply '%s' as log setting",opt);
54 /*remove this from argv*/
55 for (j=i+1; j<*argc; j++) {
60 i--; /* compensate effect of next loop incrementation */
61 WARN1("argc %d",*argc);
64 if (!found && defaultlog) {
65 TRYFAIL(gras_log_control_set(defaultlog));
68 /** init other submodules */
77 * Finalize the gras mecanisms.
81 INFO0("Exiting GRAS");
86 DEBUG0("Exited GRAS");