• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.57
/libs/core/logging/src/logging.cpp
1
//  Copyright (c) 2007-2025 Hartmut Kaiser
2
//  Copyright (c)      2011 Bryce Lelbach
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/config.hpp>
9

10
#if defined(HPX_HAVE_LOGGING)
11
#include <hpx/logging/config/defines.hpp>
12
#include <hpx/logging/api.hpp>
13
#include <hpx/modules/filesystem.hpp>
14
#include <hpx/modules/format.hpp>
15

16
#include <string>
17
#include <utility>
18
#include <vector>
19

20
#include <hpx/config/warnings_prefix.hpp>
21

22
///////////////////////////////////////////////////////////////////////////////
23
namespace hpx::util {
24

11,562✔
25
    HPX_DEFINE_LOG(app, disable_all)
11,562✔
26
    HPX_DEFINE_LOG(app_console, disable_all)
×
27
    HPX_DEFINE_LOG(app_error, fatal)
11,562✔
28
    HPX_DEFINE_LOG(debuglog, disable_all)
11,562✔
29
    HPX_DEFINE_LOG(debuglog_console, disable_all)
×
30
    HPX_DEFINE_LOG(debuglog_error, fatal)
3,466,746✔
31
    HPX_DEFINE_LOG(hpx, disable_all)
11,690✔
32
    HPX_DEFINE_LOG(hpx_console, disable_all)
11,690✔
33
    HPX_DEFINE_LOG(hpx_error, fatal)
34

35
#if defined(HPX_LOGGING_HAVE_SEPARATE_DESTINATIONS)
18,570✔
36
    HPX_DEFINE_LOG(agas, disable_all)
11,562✔
37
    HPX_DEFINE_LOG(agas_console, disable_all)
699,225✔
38
    HPX_DEFINE_LOG(parcel, disable_all)
11,562✔
39
    HPX_DEFINE_LOG(parcel_console, disable_all)
13,750✔
40
    HPX_DEFINE_LOG(timing, disable_all)
11,562✔
41
    HPX_DEFINE_LOG(timing_console, disable_all)
42
#endif
43

44
    namespace detail {
45

768✔
46
        hpx::util::logging::level get_log_level(
47
            std::string const& env, bool allow_always)
48
        {
49
            try
50
            {
768✔
51
                int const env_val = hpx::util::from_string<int>(env);
768✔
52
                if (env_val < 0)
53
                    return hpx::util::logging::level::disable_all;
54

128✔
55
                switch (env_val)
56
                {
128✔
57
                case 0:
128✔
58
                    return allow_always ?
59
                        hpx::util::logging::level::always :
60
                        hpx::util::logging::level::disable_all;
61
                case 1:
62
                    return hpx::util::logging::level::fatal;
×
63
                case 2:
×
64
                    return hpx::util::logging::level::error;
×
65
                case 3:
×
66
                    return hpx::util::logging::level::warning;
×
67
                case 4:
×
68
                    return hpx::util::logging::level::info;
69
                default:
70
                    break;
71
                }
×
72
                return hpx::util::logging::level::debug;
73
            }
×
74
            catch (hpx::util::bad_lexical_cast const&)
75
            {
76
                return hpx::util::logging::level::disable_all;
×
77
            }
78
        }
79
    }    // namespace detail
80
}    // namespace hpx::util
81

82
///////////////////////////////////////////////////////////////////////////////
83
#include <hpx/logging/detail/logger.hpp>
84

85
namespace hpx::util::logging {
86

1,024✔
87
    void logger::turn_cache_off() const
88
    {
1,024✔
89
        if (m_is_caching_off)
192✔
90
            return;    // already turned off
91

832✔
92
        m_is_caching_off = true;
93

94
        // dump messages
95
        std::vector<message> msgs;
96
        std::swap(m_cache, msgs);
97

832✔
98
        for (auto& msg : msgs)
×
99
            m_writer(msg);
832✔
100
    }
101
}    // namespace hpx::util::logging
102

103
#include <hpx/config/warnings_suffix.hpp>
104

105
#endif    // HPX_HAVE_LOGGING
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc