SOLA
All Classes Namespaces Functions Variables Enumerations Friends Pages
logging.h
1// Copyright The SOLA Contributors
2//
3// Licensed under the MIT License.
4// For details on the licensing terms, see the LICENSE file.
5// SPDX-License-Identifier: MIT
6
7#ifndef MINHTON_LOGGING_LOGGING_H_
8#define MINHTON_LOGGING_LOGGING_H_
9
10#include "minhton/logging/logger.h"
11
12#define LOG_CRITICAL(M) access_->logger.logCritical(M)
13#define LOG_WARNING(M) access_->logger.logWarning(M)
14#define LOG_INFO(M) access_->logger.logInfo(M)
15#define LOG_DEBUG(M) access_->logger.logDebug(M)
16
17#define LOG_NODE(n) \
18 (access_->logger.logNode(minhton::LoggerInfoAddNode{n.getLogicalNodeInfo().getUuid(), \
19 n.getLevel(), n.getNumber(), n.getFanout(), \
20 n.isValidPeer()}))
21
22#define LOG_EVENT(event_type, event_id) \
23 (access_->logger.logEvent(minhton::LoggerInfoAddEvent{0, event_type, event_id}))
24
25#define LOG_SEARCH_EXACT(status, event_id, sender, target, hop) \
26 (access_->logger.logSearchExactTest(minhton::LoggerInfoSearchExact{ \
27 0, event_id, status, sender.getLevel(), sender.getNumber(), target.getLevel(), \
28 target.getNumber(), hop.getLevel(), hop.getNumber()}))
29
30#define LOG_CONTENT(n, content_status, attribute_name, content_type, content_text) \
31 (access_->logger.logContent(minhton::LoggerInfoAddContent{0, n.getLogicalNodeInfo().getUuid(), \
32 content_status, attribute_name, \
33 content_type, content_text}))
34
35#define LOG_FIND_QUERY(event_id, initiator, find_query) \
36 (access_->logger.logFindQuery(minhton::LoggerInfoAddFindQuery{ \
37 0, event_id, initiator.getLogicalNodeInfo().getUuid(), \
38 find_query.getInquireUnknownAttributes(), find_query.getInquireOutdatedAttributes(), \
39 find_query.serializeBooleanExpression()}))
40
41#define LOG_FIND_QUERY_RESULT(event_id, result_node) \
42 (access_->logger.logFindQueryResult(minhton::LoggerInfoAddFindQueryResult{ \
43 0, event_id, result_node.getLogicalNodeInfo().getUuid()}))
44
45#endif