pgbackrest.git / summary / log / commit / refs
commit 2f6017511fda3c6aeb67c3daafcc6c1dc35b2dd4
Author: David Steele <david@crunchydata.com>
Date: Wed May 23 13:45:08 2018 +0000
Split log levels into separate header file.
Many modules that use debug.h do not need to do logging so this reduces dependencies for those modules.
doc/xml/release.xml | 7 +++++++
src/cipher/block.c | 1 +
src/cipher/cipher.c | 1 +
src/cipher/random.c | 1 +
src/common/fork.c | 1 +
src/common/io/handle.c | 1 +
src/common/lock.c | 1 +
src/common/log.h | 21 ++-------------------
src/common/logLevel.h | 26 ++++++++++++++++++++++++++
src/common/stackTrace.c | 1 -
src/common/stackTrace.h | 3 ++-
src/common/wait.c | 1 +
src/postgres/info.c | 1 +
src/postgres/pageChecksum.c | 1 +
src/storage/driver/posix/driver.c | 1 +
src/storage/driver/posix/driverRead.c | 1 +
src/storage/driver/posix/driverWrite.c | 1 +
src/storage/fileRead.c | 1 +
src/storage/fileWrite.c | 1 +
src/storage/storage.c | 1 +
test/src/module/common/debugOnTest.c | 2 ++
21 files changed, 54 insertions(+), 21 deletions(-)
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index ed6267ca9..9d5cc5c87 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -13,6 +13,13 @@
<release-list>
<release date="XXXX-XX-XX" version="2.04dev" title="UNDER DEVELOPMENT">
+ <release-core-list>
+ <release-development-list>
+ <release-item>
+ <p>Split log levels into separate header file. Many modules that use <code>debug.h</code> do not need to do logging so this reduces dependencies for those modules.</p>
+ </release-item>
+ </release-development-list>
+ </release-core-list>
</release>
<release date="2018-05-22" version="2.03" title="Single Executable to Deploy">
diff --git a/src/cipher/block.c b/src/cipher/block.c
index 7f40956c1..a3bd3b267 100644
--- a/src/cipher/block.c
+++ b/src/cipher/block.c
@@ -7,6 +7,7 @@ Block Cipher
#include <openssl/err.h>
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "cipher/block.h"
#include "cipher/random.h"
diff --git a/src/cipher/cipher.c b/src/cipher/cipher.c
index aee565227..10cc9b49e 100644
--- a/src/cipher/cipher.c
+++ b/src/cipher/cipher.c
@@ -7,6 +7,7 @@ Cipher General Init and Free
#include "cipher/cipher.h"
#include "common/debug.h"
+#include "common/log.h"
/***********************************************************************************************************************************
Flag to indicate if OpenSSL has already been initialized
diff --git a/src/cipher/random.c b/src/cipher/random.c
index c88dce4b0..722d105a4 100644
--- a/src/cipher/random.c
+++ b/src/cipher/random.c
@@ -6,6 +6,7 @@ Cipher
#include "cipher/random.h"
#include "common/debug.h"
#include "common/error.h"
+#include "common/log.h"
/***********************************************************************************************************************************
Generate random bytes
diff --git a/src/common/fork.c b/src/common/fork.c
index 4c5bccae7..d3562a6c4 100644
--- a/src/common/fork.c
+++ b/src/common/fork.c
@@ -5,6 +5,7 @@ Fork Handler
#include "common/debug.h"
#include "common/error.h"
+#include "common/log.h"
/***********************************************************************************************************************************
Fork a new process and detach it so it can continue running after the parent process has exited. This is not a typical daemon
diff --git a/src/common/io/handle.c b/src/common/io/handle.c
index 51c20c629..9de51aaa2 100644
--- a/src/common/io/handle.c
+++ b/src/common/io/handle.c
@@ -6,6 +6,7 @@ Handle IO
#include "common/debug.h"
#include "common/error.h"
#include "common/io/handle.h"
+#include "common/log.h"
/***********************************************************************************************************************************
Write a string to the specified handle
diff --git a/src/common/lock.c b/src/common/lock.c
index 3d68dc4c3..142edf271 100644
--- a/src/common/lock.c
+++ b/src/common/lock.c
@@ -11,6 +11,7 @@ Lock Handler
#include "common/debug.h"
#include "common/io/handle.h"
#include "common/lock.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "common/wait.h"
#include "storage/helper.h"
diff --git a/src/common/log.h b/src/common/log.h
index d3f6f05bb..a746d46d2 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -6,6 +6,8 @@ Log Handler
#include <stdbool.h>
+#include "common/logLevel.h"
+
/***********************************************************************************************************************************
Max size allowed for a single log message including header
***********************************************************************************************************************************/
@@ -13,25 +15,6 @@ Max size allowed for a single log message including header
#define LOG_BUFFER_SIZE ((size_t)(32 * 1024))
#endif
-/***********************************************************************************************************************************
-Log types
-***********************************************************************************************************************************/
-typedef enum
-{
- logLevelOff,
- logLevelAssert,
- logLevelError,
- logLevelProtocol,
- logLevelWarn,
- logLevelInfo,
- logLevelDetail,
- logLevelDebug,
- logLevelTrace,
-} LogLevel;
-
-#define LOG_LEVEL_MIN logLevelAssert
-#define LOG_LEVEL_MAX logLevelTrace
-
/***********************************************************************************************************************************
Expose internal data for unit testing/debugging
***********************************************************************************************************************************/
diff --git a/src/common/logLevel.h b/src/common/logLevel.h
new file mode 100644
index 000000000..506a26fa0
--- /dev/null
+++ b/src/common/logLevel.h
@@ -0,0 +1,26 @@
+/***********************************************************************************************************************************
+Log Levels
+***********************************************************************************************************************************/
+#ifndef COMMON_LOGLEVEL_H
+#define COMMON_LOGLEVEL_H
+
+/***********************************************************************************************************************************
+Log types
+***********************************************************************************************************************************/
+typedef enum
+{
+ logLevelOff,
+ logLevelAssert,
+ logLevelError,
+ logLevelProtocol,
+ logLevelWarn,
+ logLevelInfo,
+ logLevelDetail,
+ logLevelDebug,
+ logLevelTrace,
+} LogLevel;
+
+#define LOG_LEVEL_MIN logLevelAssert
+#define LOG_LEVEL_MAX logLevelTrace
+
+#endif
diff --git a/src/common/stackTrace.c b/src/common/stackTrace.c
index fc16b4fb8..40081d579 100644
--- a/src/common/stackTrace.c
+++ b/src/common/stackTrace.c
@@ -12,7 +12,6 @@ Stack Trace Handler
#include "common/assert.h"
#include "common/error.h"
-#include "common/log.h"
#include "common/stackTrace.h"
/***********************************************************************************************************************************
diff --git a/src/common/stackTrace.h b/src/common/stackTrace.h
index f2d1ee15f..770bf292c 100644
--- a/src/common/stackTrace.h
+++ b/src/common/stackTrace.h
@@ -4,9 +4,10 @@ Stack Trace Handler
#ifndef COMMON_STACKTRACE_H
#define COMMON_STACKTRACE_H
+#include <stdbool.h>
#include <sys/types.h>
-#include "common/log.h"
+#include "common/logLevel.h"
/***********************************************************************************************************************************
Maximum size of a single parameter (including NULL terminator)
diff --git a/src/common/wait.c b/src/common/wait.c
index 1970ecf16..449f26a17 100644
--- a/src/common/wait.c
+++ b/src/common/wait.c
@@ -2,6 +2,7 @@
Wait Handler
***********************************************************************************************************************************/
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "common/time.h"
#include "common/wait.h"
diff --git a/src/postgres/info.c b/src/postgres/info.c
index af5b979f0..296208936 100644
--- a/src/postgres/info.c
+++ b/src/postgres/info.c
@@ -2,6 +2,7 @@
PostgreSQL Info
***********************************************************************************************************************************/
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "postgres/info.h"
#include "postgres/type.h"
diff --git a/src/postgres/pageChecksum.c b/src/postgres/pageChecksum.c
index 09acbd362..a94d4c707 100644
--- a/src/postgres/pageChecksum.c
+++ b/src/postgres/pageChecksum.c
@@ -67,6 +67,7 @@ minimize register spilling. For less sophisticated compilers it might be benefic
#include "common/assert.h"
#include "common/debug.h"
#include "common/error.h"
+#include "common/log.h"
#include "postgres/pageChecksum.h"
#include "postgres/type.h"
diff --git a/src/storage/driver/posix/driver.c b/src/storage/driver/posix/driver.c
index 740583401..5d15912f2 100644
--- a/src/storage/driver/posix/driver.c
+++ b/src/storage/driver/posix/driver.c
@@ -14,6 +14,7 @@ Storage Driver Posix
#include <unistd.h>
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "common/regExp.h"
#include "storage/driver/posix/driver.h"
diff --git a/src/storage/driver/posix/driverRead.c b/src/storage/driver/posix/driverRead.c
index a7137b0f0..f23de32b9 100644
--- a/src/storage/driver/posix/driverRead.c
+++ b/src/storage/driver/posix/driverRead.c
@@ -6,6 +6,7 @@ Storage File Read Driver For Posix
#include "common/assert.h"
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "storage/driver/posix/driverFile.h"
#include "storage/driver/posix/driverRead.h"
diff --git a/src/storage/driver/posix/driverWrite.c b/src/storage/driver/posix/driverWrite.c
index 370f1bdb5..8829881df 100644
--- a/src/storage/driver/posix/driverWrite.c
+++ b/src/storage/driver/posix/driverWrite.c
@@ -7,6 +7,7 @@ Storage File Write Driver For Posix
#include "common/assert.h"
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "storage/driver/posix/driverFile.h"
#include "storage/driver/posix/driverWrite.h"
diff --git a/src/storage/fileRead.c b/src/storage/fileRead.c
index 1b8feb24a..7b95694a7 100644
--- a/src/storage/fileRead.c
+++ b/src/storage/fileRead.c
@@ -3,6 +3,7 @@ Storage File Read
***********************************************************************************************************************************/
#include "common/assert.h"
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "storage/fileRead.h"
diff --git a/src/storage/fileWrite.c b/src/storage/fileWrite.c
index 329aa23bc..ce303b1ea 100644
--- a/src/storage/fileWrite.c
+++ b/src/storage/fileWrite.c
@@ -3,6 +3,7 @@ Storage File Write
***********************************************************************************************************************************/
#include "common/assert.h"
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "storage/fileWrite.h"
diff --git a/src/storage/storage.c b/src/storage/storage.c
index 1ff5c9ce1..61ee7edf6 100644
--- a/src/storage/storage.c
+++ b/src/storage/storage.c
@@ -6,6 +6,7 @@ Storage Manager
#include "common/assert.h"
#include "common/debug.h"
+#include "common/log.h"
#include "common/memContext.h"
#include "common/wait.h"
#include "storage/driver/posix/driver.h"
diff --git a/test/src/module/common/debugOnTest.c b/test/src/module/common/debugOnTest.c
index e3ad63734..018f1a7c0 100644
--- a/test/src/module/common/debugOnTest.c
+++ b/test/src/module/common/debugOnTest.c
@@ -1,6 +1,8 @@
/***********************************************************************************************************************************
Test Debug Macros and Routines
***********************************************************************************************************************************/
+#include "common/log.h"
+
#include "common/logTest.h"
static void
[parent: dfa92b359ded]