blob: 267a08d4aeb06a95d6ff841a3d4629c38161d30a [file] [log] [blame]
Alexander Afanasyev71b43e72012-12-27 01:03:43 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 * Zhenkai Zhu <zhenkai@cs.ucla.edu>
20 */
21
22#ifndef SYNC_LOG_H
23#define SYNC_LOG_H
24
25#define INIT_LOGGER(name)
26#define _LOG_FUNCTION(x)
27#define _LOG_FUNCTION_NOARGS
28#define _LOG_TRACE(x)
29#define INIT_LOGGERS(x)
30
31#ifdef _DEBUG
32
33#include <boost/thread/thread.hpp>
34#include <boost/date_time/posix_time/posix_time.hpp>
35#include <iostream>
36#include <string>
37
38#define _LOG_DEBUG(x) \
39 std::clog << boost::get_system_time () << " " << boost::this_thread::get_id () << " " << x << std::endl;
40
41#else
42#define _LOG_DEBUG(x)
43#endif
44
45#define _LOG_ERROR(x) \
46 std::clog << boost::get_system_time () << " " << boost::this_thread::get_id () << " " << x << std::endl;
47
48#endif // SYNC_LOG_H