Debian Codegraph @

src/atlas/runtime/Log.cc

raw
1 /*
2 * (C) Copyright 2013 ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation
8 * nor does it submit to any jurisdiction.
9 */
10
11 #include "eckit/os/BackTrace.h"
12
13 #include "atlas/library/Library.h"
14 #include "atlas/parallel/mpi/mpi.h"
15 #include "atlas/runtime/Log.h"
16
17 #if ATLAS_HAVE_FORTRAN
18 #include "fckit/Log.h"
19 #endif
20
21 namespace atlas {
22
23 std::string backtrace() {
24 return eckit::BackTrace::dump();
25 }
26
27 namespace detail {
28
29 void debug_parallel_here(const eckit::CodeLocation& here) {
30 const auto& comm = mpi::comm();
31 comm.barrier();
32 Log::info() << "DEBUG_PARALLEL() @ " << here << std::endl;
33 }
34
35 void debug_parallel_what(const eckit::CodeLocation& here, const std::string& what) {
36 const auto& comm = mpi::comm();
37 comm.barrier();
38 Log::info() << "DEBUG_PARALLEL(" << what << ") @ " << here << std::endl;
39 }
40
41 } // namespace detail
42
43 Log::Channel& Log::info() {
44 return atlas::Library::instance().infoChannel();
45 }
46
47 Log::Channel& Log::warning() {
48 return atlas::Library::instance().warningChannel();
49 }
50
51 Log::Channel& Log::trace() {
52 return atlas::Library::instance().traceChannel();
53 }
54
55 Log::Channel& Log::debug() {
56 return atlas::Library::instance().debugChannel();
57 }
58
59 void Log::addFortranUnit(int unit, Style style, const char* prefix) {
60 #if ATLAS_HAVE_FORTRAN
61 fckit::Log::addFortranUnit(unit, fckit::Log::Style(style), prefix);
62 #else
63 /*NOTIMP*/
64 #endif
65 }
66
67 void Log::setFortranUnit(int unit, Style style, const char* prefix) {
68 #if ATLAS_HAVE_FORTRAN
69 fckit::Log::setFortranUnit(unit, fckit::Log::Style(style), prefix);
70 #else
71 /*NOTIMP*/
72 #endif
73 }
74
75 } // namespace atlas