summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwarren%netscape.com <devnull@localhost>1998-09-01 00:17:18 +0000
committerwarren%netscape.com <devnull@localhost>1998-09-01 00:17:18 +0000
commitaed8bd05179c647e0296117173d037c4b6e7cc90 (patch)
treef59ec712b4c4421d3f933a11c5563f2e4f3b30b6
parentfdf57ed65264a4c98861754dc1464c0167976acb (diff)
downloadnspr-hg-aed8bd05179c647e0296117173d037c4b6e7cc90.tar.gz
Added PR_DestroyLogModule.
-rw-r--r--pr/include/prlog.h5
-rw-r--r--pr/src/io/prlog.c23
2 files changed, 27 insertions, 1 deletions
diff --git a/pr/include/prlog.h b/pr/include/prlog.h
index ba31361a..9be6c13f 100644
--- a/pr/include/prlog.h
+++ b/pr/include/prlog.h
@@ -141,6 +141,11 @@ typedef struct PRLogModuleInfo {
PR_EXTERN(PRLogModuleInfo*) PR_NewLogModule(const char *name);
/*
+** Destroys a log module.
+*/
+PR_EXTERN(void) PR_DestroyLogModule(PRLogModuleInfo* logModule);
+
+/*
** Set the file to use for logging. Returns PR_FALSE if the file cannot
** be created
*/
diff --git a/pr/src/io/prlog.c b/pr/src/io/prlog.c
index 62d79bf4..98c7e639 100644
--- a/pr/src/io/prlog.c
+++ b/pr/src/io/prlog.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
@@ -310,6 +310,27 @@ PR_IMPLEMENT(PRLogModuleInfo*) PR_NewLogModule(const char *name)
return lm;
}
+PR_IMPLEMENT(void) PR_DestroyLogModule(PRLogModuleInfo* lm)
+{
+ PR_LogFlush();
+
+ /* unlink this log module from the list */
+ if (lm == logModules) {
+ logModules = logModules->next;
+ }
+ else {
+ PRLogModuleInfo* chain = logModules;
+ while (chain && chain->next != lm)
+ chain = chain->next;
+ PR_ASSERT(chain && chain->next);
+ chain->next = chain->next->next;
+ }
+
+ /* and free it */
+ free((void*)lm->name);
+ PR_Free(lm);
+}
+
PR_IMPLEMENT(PRBool) PR_SetLogFile(const char *file)
{
#ifdef PR_LOGGING