summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime/gr_logger.i
blob: 1eedf3d60d2a4b0f54562593110edd7970bb49f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* -*- c++ -*- */
/*
 * Copyright 2012 Free Software Foundation, Inc.
 * 
 * This file is part of GNU Radio
 * 
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/*******************************************************************************
* Copyright 2011 Johns Hopkins University Applied Physics Lab
* Author: Mark Plett
* Description:
*   SWIG interface generator file for gr_logger module.  gr_logger wraps log4cxx logging
*   for gnuradio.
*******************************************************************************/

%feature("autodoc", "1");		// generate python docstrings

%include "exception.i"
%import "gnuradio.i"			// the common stuff

%{
#include "gnuradio_swig_bug_workaround.h"	// mandatory bug fix
#include <stdexcept>
%}

//-----------------------------------

#ifdef ENABLE_GR_LOG
#ifdef HAVE_LOG4CXX

%{
// The .h files
#include <gr_logger.h>
#include <log4cxx/logger.h>
#include <log4cxx/logmanager.h>
%}

namespace log4cxx{
class LoggerPtr {
public:
 ~LoggerPtr();
};
};
void logger_load_config(const std::string &config_filename);
void logger_set_level(log4cxx::LoggerPtr logger, const std::string &level);

%rename(log) gr_logger;

class gr_logger
{
private:
  
public:
  //gr_logger(std::string config_filename);
  gr_logger(std::string config_filename,int watchPeriodSec);
  void set_level(std::string name,std::string level);
  void get_level(std::string name,std::string &level);
  void trace(std::string name,std::string msg);
  void debug(std::string name,std::string msg);
  void info(std::string name,std::string msg);
  void warn(std::string name,std::string msg);
  void error(std::string name,std::string msg);
  void fatal(std::string name,std::string msg);
  void errorIF(std::string name,bool cond,std::string msg);
  void gr_assert(std::string name,bool cond,std::string msg);

  static log4cxx::LoggerPtr getLogger(std::string name);

  void set_log_level(log4cxx::LoggerPtr logger,std::string level);
  void get_log_level(log4cxx::LoggerPtr logger,std::string &level);
  void log_trace(log4cxx::LoggerPtr logger,std::string msg);
  void log_debug(log4cxx::LoggerPtr logger,std::string msg);
  void log_info(log4cxx::LoggerPtr logger,std::string msg);
  void log_warn(log4cxx::LoggerPtr logger,std::string msg);
  void log_error(log4cxx::LoggerPtr logger,std::string msg);
  void log_fatal(log4cxx::LoggerPtr logger,std::string msg);
  void log_errorIF(log4cxx::LoggerPtr logger,bool cond,std::string msg);
  void log_assert(log4cxx::LoggerPtr logger,bool cond,std::string msg);
};

#endif /* HAVE_LOG4CXX */
#endif /* ENABLE_GR_LOG */