Merge branch 'av_logging' into storageareas

This commit is contained in:
Isaac Connor 2018-11-23 12:46:27 -05:00
commit c89bb8bc16
8 changed files with 18 additions and 7 deletions

View File

@ -17,9 +17,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// //
#if !defined(PATH_MAX)
#define PATH_MAX 1024
#endif
#ifndef ZM_H #ifndef ZM_H
#define ZM_H #define ZM_H

View File

@ -20,6 +20,7 @@
#ifndef ZM_COMMS_H #ifndef ZM_COMMS_H
#define ZM_COMMS_H #define ZM_COMMS_H
#include "zm_logger.h"
#include "zm_exception.h" #include "zm_exception.h"
#include <string.h> #include <string.h>

View File

@ -20,9 +20,11 @@
#ifndef ZM_CONFIG_H #ifndef ZM_CONFIG_H
#define ZM_CONFIG_H #define ZM_CONFIG_H
#if !defined(PATH_MAX)
#define PATH_MAX 1024
#endif
#include "config.h" #include "config.h"
#include "zm_config_defines.h" #include "zm_config_defines.h"
#include "zm.h"
#include <string> #include <string>

View File

@ -20,8 +20,6 @@
#ifndef ZM_EXCEPTION_H #ifndef ZM_EXCEPTION_H
#define ZM_EXCEPTION_H #define ZM_EXCEPTION_H
#include "zm.h"
#include <string> #include <string>
class Exception class Exception

View File

@ -43,10 +43,14 @@ void log_libav_callback( void *ptr, int level, const char *fmt, va_list vargs )
log_level = Logger::DEBUG1; log_level = Logger::DEBUG1;
} else if ( level == AV_LOG_DEBUG ) { //48 } else if ( level == AV_LOG_DEBUG ) { //48
log_level = Logger::DEBUG2; log_level = Logger::DEBUG2;
#ifdef AV_LOG_TRACE
} else if ( level == AV_LOG_TRACE ) { } else if ( level == AV_LOG_TRACE ) {
log_level = Logger::DEBUG8; log_level = Logger::DEBUG8;
#endif
#ifdef AV_LOG_MAX_OFFSET
} else if ( level == AV_LOG_MAX_OFFSET ) { } else if ( level == AV_LOG_MAX_OFFSET ) {
log_level = Logger::DEBUG9; log_level = Logger::DEBUG9;
#endif
} else { } else {
Error("Unknown log level %d", level); Error("Unknown log level %d", level);
} }

View File

@ -444,6 +444,7 @@ void Logger::closeSyslog() {
void Logger::logPrint( bool hex, const char * const filepath, const int line, const int level, const char *fstring, ... ) { void Logger::logPrint( bool hex, const char * const filepath, const int line, const int level, const char *fstring, ... ) {
if ( level > mEffectiveLevel ) if ( level > mEffectiveLevel )
return; return;
log_mutex.lock();
char timeString[64]; char timeString[64];
char logString[8192]; char logString[8192];
va_list argPtr; va_list argPtr;
@ -579,6 +580,7 @@ void Logger::logPrint( bool hex, const char * const filepath, const int line, co
abort(); abort();
exit(-1); exit(-1);
} }
log_mutex.unlock();
} }

View File

@ -30,6 +30,8 @@
#endif // HAVE_SYS_SYSCALL_H #endif // HAVE_SYS_SYSCALL_H
#include <mysql/mysql.h> #include <mysql/mysql.h>
#include "zm_thread.h"
class Logger { class Logger {
public: public:
enum { enum {
@ -82,6 +84,8 @@ private:
static bool smInitialised; static bool smInitialised;
static Logger *smInstance; static Logger *smInstance;
RecursiveMutex log_mutex;
static StringMap smCodes; static StringMap smCodes;
static IntMap smSyslogPriorities; static IntMap smSyslogPriorities;

View File

@ -20,9 +20,12 @@
#ifndef ZM_THREAD_H #ifndef ZM_THREAD_H
#define ZM_THREAD_H #define ZM_THREAD_H
class RecursiveMutex;
#include "zm_config.h"
#include <unistd.h> #include <unistd.h>
#include <pthread.h> #include <pthread.h>
#include <unistd.h>
#ifdef HAVE_SYS_SYSCALL_H #ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h> #include <sys/syscall.h>
#endif // HAVE_SYS_SYSCALL_H #endif // HAVE_SYS_SYSCALL_H