Hi there, while having some problems with my hbci account i found that unlike with aqbanking-tool there is no way in aqhbci-tool to set the loglevel dynamically. I took the code from aqbanking-tool so the syntax on the command-line is the same (and it was an easy task ;) ) Perhaps you want to check the logdomain before you include the patch. I wasn't sure what the right name would be. Hope this helps Martin
diff -ru src/plugins/backends/aqhbci/tools/aqhbci-tool.original/main.c src/plugins/backends/aqhbci/tools/aqhbci-tool/main.c
--- src/plugins/backends/aqhbci/tools/aqhbci-tool.original/main.c 2006-04-03 16:34:18.000000000 +0200
+++ src/plugins/backends/aqhbci/tools/aqhbci-tool/main.c 2006-06-07 10:26:49.000000000 +0200
@@ -33,6 +33,9 @@
GWEN_DB_NODE *db;
const char *cmd;
int rv;
+ const char *s;
+ GWEN_LOGGER_LOGTYPE logType;
+ GWEN_LOGGER_LEVEL logLevel;
AB_BANKING *ab;
const GWEN_ARGS args[]={
{
@@ -45,8 +48,42 @@
"cfgfile", /* long option */
"Specify the configuration file", /* short description */
"Specify the configuration file" /* long description */
+ },
+ {
+ GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
+ GWEN_ArgsTypeChar, /* type */
+ "logtype", /* name */
+ 0, /* minnum */
+ 1, /* maxnum */
+ 0, /* short option */
+ "logtype", /* long option */
+ "Set the logtype", /* short description */
+ "Set the logtype (console, file)."
},
{
+ GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
+ GWEN_ArgsTypeChar, /* type */
+ "loglevel", /* name */
+ 0, /* minnum */
+ 1, /* maxnum */
+ 0, /* short option */
+ "loglevel", /* long option */
+ "Set the log level", /* short description */
+ "Set the log level (info, notice, warning, error)."
+ },
+ {
+ GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
+ GWEN_ArgsTypeChar, /* type */
+ "logfile", /* name */
+ 0, /* minnum */
+ 1, /* maxnum */
+ 0, /* short option */
+ "logfile", /* long option */
+ "Set the log file", /* short description */
+ "Set the log file (if log type is \"file\")."
+ },
+
+ {
GWEN_ARGS_FLAGS_HELP | GWEN_ARGS_FLAGS_LAST, /* flags */
GWEN_ArgsTypeInt, /* type */
"help", /* name */
@@ -151,7 +188,32 @@
argv+=rv-1;
}
- /*GWEN_Logger_SetLevel(AQHBCI_LOGDOMAIN, GWEN_LoggerLevelInfo); */
+ /* setup logging */
+ s=GWEN_DB_GetCharValue(db, "loglevel", 0, "warning");
+ logLevel=GWEN_Logger_Name2Level(s);
+ if (logLevel==GWEN_LoggerLevelUnknown) {
+ fprintf(stderr, "ERROR: Unknown log level (%s)\n", s);
+ return 1;
+ }
+ s=GWEN_DB_GetCharValue(db, "logtype", 0, "console");
+ logType=GWEN_Logger_Name2Logtype(s);
+ if (logType==GWEN_LoggerTypeUnknown) {
+ fprintf(stderr, "ERROR: Unknown log type (%s)\n", s);
+ return 1;
+ }
+ rv=GWEN_Logger_Open(AQHBCI_LOGDOMAIN,
+ "aqhbci-tool",
+ GWEN_DB_GetCharValue(db, "logfile", 0,
+ "aqhbci-tool.log"),
+ logType,
+ GWEN_LoggerFacilityUser);
+ if (rv) {
+ fprintf(stderr, "ERROR: Could not setup logging (%d).\n", rv);
+ return 2;
+ }
+ GWEN_Logger_SetLevel(AQHBCI_LOGDOMAIN, logLevel);
+
+
cmd=GWEN_DB_GetCharValue(db, "params", 0, 0);
if (!cmd) {
pgpBsmi9bNRf2.pgp
Description: PGP signature
_______________________________________________ Aqbanking-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/aqbanking-devel
