Console

Defines C++ wrapper to log/print text messages. More...

Classes

Type Name
class eosio::iostream

Functions

Detailed Description

This API uses C++ variadic templates and type detection to make it easy to print any native type. You can even overload the method for your own custom types. Example:

print( "hello world, this is a number: ", 5 );

Functions Documentation

function printhex

void eosio::printhex(
    const void * ptr,
    uint32_t size
)

Prints hexidecimal data of length datalen.

Prints a block of bytes in hexadecimal

Parameters:

  • ptr - pointer to bytes of interest
  • size - number of bytes to print

function printl

void eosio::printl(
    const char * ptr,
    size_t len
)

Prints string to a given length

Parameters:

  • ptr - a string
  • len - number of chars to print

function print

void eosio::print(
    const char * ptr
)

Prints string

Parameters:

  • ptr - a null terminated string

function print

void eosio::print(
    float num
)

Prints single-precision floating point number (i.e. float)

Parameters:

  • num to be printed

function print

void eosio::print(
    double num
)

Prints double-precision floating point number (i.e. double)

Parameters:

  • num to be printed

function print

void eosio::print(
    long double num
)

Prints quadruple-precision floating point number (i.e. long double)

Parameters:

  • num to be printed

function print

template<typename T, std::enable_if_t<!std::is_integral< std::decay_t< T >>::value, int >>
void eosio::print(
    T && t
)

Prints class object

Parameters:

  • t to be printed

Precondition:

T must implements print() function

function print_f

void eosio::print_f(
    const char * s
)

Prints null terminated string

Parameters:

  • s null terminated string to be printed