• 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

0.0
/libs/core/logging/src/level.cpp
1
//  Copyright (c) 2007-2022 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
#include <hpx/logging/level.hpp>
10

11
#if defined(HPX_HAVE_LOGGING)
12
#include <cstddef>
13
#include <iomanip>
14
#include <ostream>
15
#include <stdexcept>
16
#include <string>
17
#include <string_view>
18

19
///////////////////////////////////////////////////////////////////////////////
20
namespace hpx::util::logging {
21

×
22
    [[nodiscard]] static std::string levelname(level value)
23
    {
×
24
        switch (value)
25
        {
26
        case hpx::util::logging::level::enable_all:
×
27
            return "<all>";
28
        case hpx::util::logging::level::debug:
×
29
            return "<debug>";
30
        case hpx::util::logging::level::info:
×
31
            return "<info>";
32
        case hpx::util::logging::level::warning:
×
33
            return "<warning>";
34
        case hpx::util::logging::level::error:
×
35
            return "<error>";
36
        case hpx::util::logging::level::fatal:
×
37
            return "<fatal>";
38
        case hpx::util::logging::level::always:
×
39
            return "<always>";
40
        default:
41
            break;
42
        }
43

×
44
        return '<' + std::to_string(static_cast<int>(value)) + '>';
45
    }
46

×
47
    void format_value(std::ostream& os, std::string_view spec, level value)
48
    {
×
49
        if (!spec.empty())
×
50
            throw std::runtime_error("Not a valid format specifier");
51

52
        os << std::right << std::setfill(' ') << std::setw(10)
×
53
           << levelname(value);
×
54
    }
55
}    // namespace hpx::util::logging
56

57
#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