#ifndef KYLINLOGGER_CPP_H
#define KYLINLOGGER_CPP_H

#include <iostream>
#include <QDebug>

extern "C"
{
    #include "../kylinlogger_C/kylinlogger_c.h"
}

#define V4L2_LOG        std::cout<< std::flush
#define CAMERA_LOG      qDebug()

typedef enum {EMERG  = 0,
                      FATAL  = 0,
                      ALERT  = 100,
                      CRIT   = 200,
                      ERROR  = 300,
                      WARN   = 400,
                      NOTICE = 500,
                      INFO   = 600,
                      DEBUG  = 700,
                      NOTSET = 800
} PriorityLevel;

extern int CamLogLevel;

#define LOG(__flag,__level) if (__level<=CamLogLevel) __flag << "\n[kylincameralibs]" << "[" << #__level << "]"  << ":"

inline int CaminitLogger(char* name,int verbose)
{
    int err;
    switch (verbose)
    {
            case 0: CamLogLevel=NOTSET; break;
            case 1: CamLogLevel=INFO; break;
            case 2: CamLogLevel=WARN; break;
            default: CamLogLevel=FATAL; break;
    }
    LOG(CAMERA_LOG,NOTICE) << "camera log level:" << CamLogLevel;
    return err;
}

#endif // KYLINLOGGER_CPP_H
