My Project
Typedefs | Functions | Variables
debug.hpp File Reference
#include "details/out_type_alert.hpp"
#include "details/out_type_debug.hpp"
#include "details/out_type_empty.hpp"
#include "details/out_type_error.hpp"
#include "details/out_type_print.hpp"
#include "details/out.hpp"
#include "char_type.hpp"
#include "conditional.hpp"
#include "cstdint.hpp"
#include "fmt.hpp"

Go to the source code of this file.

Typedefs

template<bsl::uintmax DL, typename T >
using bsl::out_t = conditional_t< DL<=BSL_DEBUG_LEVEL, out< T >, out< details::out_type_empty > >
 used to disable debugging for debug() and alert()
 

Functions

constexpr out< details::out_type_print > bsl::print () noexcept
 Returns and instance of bsl::out<T>. This version of bsl::out<T> does not print a label and does not accept a debug level (as it cannot be turned off). All output is redirected to bsl::details::putc_stdout and bsl::details::puts_stdout. See bsl::fmt for formatting documentation and examples. More...
 
template<bsl::uintmax DL = 0>
constexpr out_t< DL, details::out_type_debug > bsl::debug () noexcept
 Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "DEBUG: " when created and accepts a debug level, allowing it to be disabled. All output is redirected to bsl::details::putc_stdout and bsl::details::puts_stdout. See bsl::fmt for formatting documentation and examples. More...
 
template<bsl::uintmax DL = 0>
constexpr out_t< DL, details::out_type_alert > bsl::alert () noexcept
 Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "ALERT: " when created and accepts a debug level, allowing it to be disabled. All output is redirected to bsl::details::putc_stderr and bsl::details::puts_stderr. See bsl::fmt for formatting documentation and examples. More...
 
constexpr out< details::out_type_error > bsl::error () noexcept
 Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "ERROR: " when created and does not accept a debug level (as it cannot be turned off). All output is redirected to bsl::details::putc_stderr and bsl::details::puts_stderr. See bsl::fmt for formatting documentation and examples. More...
 

Variables

constexpr bsl::uintmax bsl::v {1U}
 defines "-v" verbose mode
 
constexpr bsl::uintmax bsl::vv {2U}
 defines "-vv" verbose mode
 
constexpr bsl::uintmax bsl::vvv {3U}
 defines "-vvv" verbose mode
 
constexpr bsl::char_type bsl::endl {'\n'}
 newline constant
 

Detailed Description

Function Documentation

◆ print()

constexpr out<details::out_type_print> bsl::print ( )
noexcept

Returns and instance of bsl::out<T>. This version of bsl::out<T> does not print a label and does not accept a debug level (as it cannot be turned off). All output is redirected to bsl::details::putc_stdout and bsl::details::puts_stdout. See bsl::fmt for formatting documentation and examples.

#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_debug_print() noexcept
{
constexpr bsl::int32 val{42};
bsl::print() << "example message: " << val << bsl::endl;
}
}
Returns
Returns and instance of bsl::out<T>

◆ debug()

template<bsl::uintmax DL = 0>
constexpr out_t<DL, details::out_type_debug> bsl::debug ( )
noexcept

Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "DEBUG: " when created and accepts a debug level, allowing it to be disabled. All output is redirected to bsl::details::putc_stdout and bsl::details::puts_stdout. See bsl::fmt for formatting documentation and examples.

#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_debug_debug() noexcept
{
constexpr bsl::int32 val{42};
bsl::debug() << "example message: " << val << bsl::endl;
}
}
Returns
Returns and instance of bsl::out<T>

◆ alert()

template<bsl::uintmax DL = 0>
constexpr out_t<DL, details::out_type_alert> bsl::alert ( )
noexcept

Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "ALERT: " when created and accepts a debug level, allowing it to be disabled. All output is redirected to bsl::details::putc_stderr and bsl::details::puts_stderr. See bsl::fmt for formatting documentation and examples.

#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_debug_alert() noexcept
{
constexpr bsl::int32 val{42};
bsl::alert() << "example message: " << val << bsl::endl;
}
}
Returns
Returns and instance of bsl::out<T>

◆ error()

constexpr out<details::out_type_error> bsl::error ( )
noexcept

Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "ERROR: " when created and does not accept a debug level (as it cannot be turned off). All output is redirected to bsl::details::putc_stderr and bsl::details::puts_stderr. See bsl::fmt for formatting documentation and examples.

#include <bsl/debug.hpp>
namespace bsl
{
inline void
example_debug_error() noexcept
{
constexpr bsl::int32 val{42};
bsl::error() << "example message: " << val << bsl::endl;
}
}
Returns
Returns and instance of bsl::out<T>