blob: d81e8a0e43f0ecd694423bd2bec77fccff974db2 [file] [log] [blame]
Alexander Afanasyevfa2f6622016-12-25 12:28:00 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -08003 * Copyright (c) 2013-2017, Regents of the University of California.
Alexander Afanasyevc507ac22013-01-21 16:01:58 -08004 *
Alexander Afanasyevfa2f6622016-12-25 12:28:00 -08005 * This file is part of ChronoShare, a decentralized file sharing application over NDN.
Alexander Afanasyevc507ac22013-01-21 16:01:58 -08006 *
Alexander Afanasyevfa2f6622016-12-25 12:28:00 -08007 * ChronoShare is free software: you can redistribute it and/or modify it under the terms
8 * of the GNU General Public License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080010 *
Alexander Afanasyevfa2f6622016-12-25 12:28:00 -080011 * ChronoShare is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080014 *
Alexander Afanasyevfa2f6622016-12-25 12:28:00 -080015 * You should have received copies of the GNU General Public License along with
16 * ChronoShare, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * See AUTHORS.md for complete list of ChronoShare authors and contributors.
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080019 */
20
Alexander Afanasyev360f41f2016-12-25 13:20:21 -080021#ifndef CHRONOSHARE_CORE_LOGGING_HPP
22#define CHRONOSHARE_CORE_LOGGING_HPP
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080023
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -080024#include <ndn-cxx/util/logger.hpp>
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080025
Alexander Afanasyev360f41f2016-12-25 13:20:21 -080026namespace ndn {
27namespace chronoshare {
28
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -080029#define _LOG_INIT(name) NDN_LOG_INIT(chronoshare.name)
Alexander Afanasyev47cf2ef2013-01-28 15:13:47 -080030
Lijing Wanga697cf22016-12-25 14:44:22 -080031#define _LOG_DEBUG(x) NDN_LOG_DEBUG(__FILE__ << ":" << __LINE__ << ":" << " " << x)
Alexander Afanasyev47cf2ef2013-01-28 15:13:47 -080032
Lijing Wanga697cf22016-12-25 14:44:22 -080033#define _LOG_TRACE(x) NDN_LOG_TRACE(__FILE__ << ":" << __LINE__ << ":" << " " << x)
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080034
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -080035#define _LOG_ERROR(x) NDN_LOG_ERROR(x)
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080036
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080037#define _LOG_ERROR_COND(cond, x) \
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -080038 do { \
39 if (cond) { \
40 _LOG_ERROR(x); \
41 } \
42 } while (false)
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080043
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080044#define _LOG_DEBUG_COND(cond, x) \
Alexander Afanasyev1cf5c432017-01-13 23:22:15 -080045 do { \
46 if (cond) { \
47 _LOG_DEBUG(x); \
48 } \
49 } while (false)
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080050
Alexander Afanasyev360f41f2016-12-25 13:20:21 -080051} // chronoshare
52} // ndn
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080053
Alexander Afanasyev360f41f2016-12-25 13:20:21 -080054#endif // CHRONOSHARE_CORE_LOGGING_HPP