From e6d8218a41cc8a58c8c9fb8ad27c0e04256e6712 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 7 May 2009 16:56:04 +0000 Subject: Ticket #827: Option in PJSUA-LIB logging config to append existing log file (thanks Robert Cichielo for the suggestion) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2686 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/include/pjsua-lib/pjsua.h | 10 ++++++++++ pjsip/src/pjsua-lib/pjsua_core.c | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'pjsip') diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index e17a7f64..cb21ea07 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -471,6 +471,16 @@ typedef struct pjsua_logging_config */ pj_str_t log_filename; + /** + * Additional flags to be given to #pj_file_open() when opening + * the log file. By default, the flag is PJ_O_WRONLY. Application + * may set PJ_O_APPEND here so that logs are appended to existing + * file instead of overwriting it. + * + * Default is 0. + */ + unsigned log_file_flags; + /** * Optional callback function to be called to write log to * application specific device. This function will be called for diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 7430fc12..b57b81e3 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -476,10 +476,11 @@ PJ_DEF(pj_status_t) pjsua_reconfigure_logging(const pjsua_logging_config *cfg) /* If output log file is desired, create the file: */ if (pjsua_var.log_cfg.log_filename.slen) { - + unsigned flags = PJ_O_WRONLY; + flags |= pjsua_var.log_cfg.log_file_flags; status = pj_file_open(pjsua_var.pool, pjsua_var.log_cfg.log_filename.ptr, - PJ_O_WRONLY, + flags, &pjsua_var.log_file); if (status != PJ_SUCCESS) { -- cgit v1.2.3