Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / gna_plugin / gna_plugin_log.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <details/ie_exception.hpp>
8
9 // #define GNA_DEBUG
10 #ifdef GNA_DEBUG
11 /**
12  * @brief used for creating graphviz charts, and layers dump
13  */
14 # define PLOT
15 # define gnalog() std::cout
16 # define gnawarn() std::cerr
17 #else
18
19 class GnaLog {
20  public :
21     template <class T>
22     GnaLog & operator << (const T &obj) {
23         return *this;
24     }
25
26     GnaLog &  operator<< (std::ostream & (*manip)(std::ostream &)) {
27         return *this;
28     }
29 };
30
31 inline GnaLog & gnalog() {
32     static GnaLog l;
33     return l;
34 }
35 inline GnaLog & gnawarn() {
36     return gnalog();
37 }
38
39 /**
40  * @brief gna_plugin exception unification
41  */
42 #ifdef __PRETTY_FUNCTION__
43 #undef __PRETTY_FUNCTION__
44 #endif
45 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
46 # define __PRETTY_FUNCTION__ __FUNCSIG__
47 #else
48 # define __PRETTY_FUNCTION__ __FUNCTION__
49 #endif
50
51
52 #endif
53
54 #define THROW_GNA_EXCEPTION THROW_IE_EXCEPTION << "[GNAPlugin] in function " << __PRETTY_FUNCTION__<< ": "