aboutsummaryrefslogtreecommitdiff
path: root/include/olm
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-13 11:53:33 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-16 11:05:57 +0100
commitb3db0e6ee14315d20ca91eff91e348e18dd119e6 (patch)
treeafe3cea009a51309f034ddb0ca14a069262f71c4 /include/olm
parent48cb5f925d3bf21c51818dbe46c864a6975ccc75 (diff)
translate logging.cpp to C
Diffstat (limited to 'include/olm')
-rw-r--r--include/olm/logging.h (renamed from include/olm/logging.hh)34
-rw-r--r--include/olm/olm.hh6
2 files changed, 23 insertions, 17 deletions
diff --git a/include/olm/logging.hh b/include/olm/logging.h
index ff84615..c713992 100644
--- a/include/olm/logging.hh
+++ b/include/olm/logging.h
@@ -13,26 +13,32 @@
* limitations under the License.
*/
-#ifndef OLM_LOGGING_HH_
-#define OLM_LOGGING_HH_
+#ifndef OLM_LOGGING_H_
+#define OLM_LOGGING_H_
-namespace olm {
+#include "olm/olm.hh"
-const unsigned int LOG_FATAL = 1;
-const unsigned int LOG_ERROR = 2;
-const unsigned int LOG_WARNING = 3;
-const unsigned int LOG_INFO = 4;
-const unsigned int LOG_DEBUG = 5;
-const unsigned int LOG_TRACE = 6;
+#ifdef __cplusplus
+extern "C" {
+#endif
-void set_log_level(unsigned int log_level);
+#define OLM_LOG_FATAL 1
+#define OLM_LOG_ERROR 2
+#define OLM_LOG_WARNING 3
+#define OLM_LOG_INFO 4
+#define OLM_LOG_DEBUG 5
+#define OLM_LOG_TRACE 6
-bool log_enabled_for(unsigned int level, const char *category);
+/* returns non-zero if logging is enabled for this level */
+int olm_log_enabled_for(unsigned int level, const char *category);
__attribute__((__format__ (__printf__, 3, 4)))
-void logf(unsigned int level, const char *category,
+void olm_logf(unsigned int level, const char *category,
const char *format, ...);
-} // namespace olm
-#endif /* OLM_LOGGING_HH_ */
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* OLM_LOGGING_H_ */
diff --git a/include/olm/olm.hh b/include/olm/olm.hh
index ceb8be9..ffecb10 100644
--- a/include/olm/olm.hh
+++ b/include/olm/olm.hh
@@ -25,9 +25,9 @@ extern "C" {
static const size_t OLM_MESSAGE_TYPE_PRE_KEY = 0;
static const size_t OLM_MESSAGE_TYPE_MESSAGE = 1;
-struct OlmAccount;
-struct OlmSession;
-struct OlmUtility;
+typedef struct OlmAccount OlmAccount;
+typedef struct OlmSession OlmSession;
+typedef struct OlmUtility OlmUtility;
/** The size of an account object in bytes */
size_t olm_account_size();