fault/fm-common/sources/fmLog.h
Tao Liu c8159ea6cb Decouple Fault Management from stx-config
Create fault management REST API service
Create fault management client and CLI shell
Add a python extension for fault management application APIs
Update fault management python APIs to use the python extension
Update fault manager to retrieve the SNMP configuration from the config file

Story: 2002828
Task: 22747

Depends-On: https://review.openstack.org/#/c/592176/
Change-Id: I888d8d23edf75d05d51594ccca55570ae366c848
Signed-off-by: Tao Liu <tao.liu@windriver.com>
2018-08-16 13:23:33 -04:00

74 lines
1.5 KiB
C

//
// Copyright (c) 2014-2018 Wind River Systems, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
#ifndef FMLOG_H_
#define FMLOG_H_
#include <stdio.h>
#include <syslog.h>
#include "fmAPI.h"
extern "C" {
}
enum {
fmLogLevelCritical=LOG_CRIT,
fmLogLevelError=LOG_ERR,
fmLogLevelWarning=LOG_WARNING,
fmLogLevelNotice=LOG_NOTICE,
fmLogLevelInfo = LOG_INFO,
fmLogLevelDebug=LOG_DEBUG,
};
#define FM_LOG_LINE_TO_STRING_impl(x) #x
#define FM_LOG_LINE_TO_STRING(x) FM_LOG_LINE_TO_STRING_impl(x)
#define PRINTF(data,...) printf(data,## __VA_ARGS__)
#define FM_TRACE_LOG(data,...) \
PRINTF(data,## __VA_ARGS__)
#define FM_LOG_MSG(level,data,...) \
fmLogMsg(level, __FILE__ "(" \
FM_LOG_LINE_TO_STRING(__LINE__) "): " \
data, ## __VA_ARGS__ )
#define FM_INFO_LOG(data,...) \
FM_LOG_MSG(fmLogLevelInfo,data,## __VA_ARGS__)
#define FM_DEBUG_LOG(data,...) \
FM_LOG_MSG(fmLogLevelDebug,data,## __VA_ARGS__)
#define FM_NOTICE_LOG(data,...) \
FM_LOG_MSG(fmLogLevelNotice,data,## __VA_ARGS__)
#define FM_WARNING_LOG(data,...) \
FM_LOG_MSG(fmLogLevelWarning,data,## __VA_ARGS__)
#define FM_ERROR_LOG(data,...) \
FM_LOG_MSG(fmLogLevelError,data,## __VA_ARGS__)
#define FM_CRITICAL_LOG(data,...) \
FM_LOG_MSG(fmLogLevelCritical,data,## __VA_ARGS__)
#define FM_MAX_LOG_LENGTH 992
void fmLoggingInit();
void fmLogMsg(int level, const char *data, ...);
bool fmLogFileInit();
void fmLogAddEventLog(SFmAlarmDataT * data, bool is_event_suppressed);
#endif