"Fossies" - the Fresh Open Source Software Archive

Member "motion-Release-4.3.0/src/logger.h" (14 Jan 2020, 2853 Bytes) of package /linux/misc/motion-Release-4.3.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "logger.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  *      logger.h
    3  *
    4  *      Include file for logger.c
    5  *
    6  *      Copyright 2005, William M. Brack
    7  *      Copyright 2008 by Angel Carpintero  (motiondevelop@gmail.com)
    8  *      This software is distributed under the GNU Public License Version 2
    9  *      See also the file 'COPYING'.
   10  *
   11  */
   12 #ifndef _INCLUDE_LOGGER_H_
   13 #define _INCLUDE_LOGGER_H_
   14 
   15 #include "motion.h"
   16 #include <syslog.h>
   17 
   18 /* Logging mode */
   19 #define LOGMODE_NONE            0   /* No logging             */
   20 #define LOGMODE_FILE            1   /* Log messages to file   */
   21 #define LOGMODE_SYSLOG          2   /* Log messages to syslog */
   22 
   23 #define NO_ERRNO                0   /* Flag to avoid how message associated to errno */
   24 #define SHOW_ERRNO              1   /* Flag to show message associated to errno */
   25 
   26 /* Log levels */
   27 #define LOG_ALL                 9
   28 #define EMG                     LOG_EMERG     /* syslog 0 motion 1 */
   29 #define ALR                     LOG_ALERT     /* syslog 1 motion 2 */
   30 #define CRT                     LOG_CRIT      /* syslog 2 motion 3 */
   31 #define ERR                     LOG_ERR       /* syslog 3 motion 4 */
   32 #define WRN                     LOG_WARNING   /* syslog 4 motion 5 */
   33 #define NTC                     LOG_NOTICE    /* syslog 5 motion 6 */
   34 #define INF                     LOG_INFO      /* syslog 6 motion 7 */
   35 #define DBG                     LOG_DEBUG     /* syslog 7 motion 8 */
   36 #define ALL                     LOG_ALL       /* syslog 8 motion 9 */
   37 #define LEVEL_DEFAULT           NTC           /* syslog 5 motion 6 default */
   38 #define SHOW_LEVEL_VALUE(x)     (x+1)
   39 
   40 /* Log types */
   41 #define TYPE_CORE               1             /* Core logs         */
   42 #define TYPE_STREAM             2             /* Stream logs       */
   43 #define TYPE_ENCODER            3             /* Encoder logs      */
   44 #define TYPE_NETCAM             4             /* Netcam logs       */
   45 #define TYPE_DB                 5             /* Database logs     */
   46 #define TYPE_EVENTS             6             /* Events logs       */
   47 #define TYPE_TRACK              7             /* Track logs        */
   48 #define TYPE_VIDEO              8             /* V4L1/2 Bktr logs  */
   49 #define TYPE_ALL                9             /* All type logs     */
   50 #define TYPE_DEFAULT            TYPE_ALL      /* Default type      */
   51 #define TYPE_DEFAULT_STR        "ALL"         /* Default name logs */
   52 
   53 #define MOTION_LOG(x, y, z, format, args...)  motion_log(x, y, z, 1, format, __FUNCTION__, ##args)
   54 
   55 int get_log_type(const char* type);
   56 const char* get_log_type_str(unsigned int type);
   57 void set_log_type(unsigned int type);
   58 const char* get_log_level_str(unsigned int level);
   59 void set_log_level(unsigned int level);
   60 void set_log_mode(int mode);
   61 FILE * set_logfile(const char *logfile_name);
   62 void motion_log(int level, unsigned int type, int errno_flag,int fncname, const char *fmt, ...);
   63 
   64 #endif