Module agora.utils.PrettyPrinter
Defines method to format types to their human readable representation
This approach allows to take the string formatting out of the type,
simplifying the implementation and reducing dependencies.
It is assumed that a human-readable representation will not rely on
non-visible (private
, package
, protected
) data,
or data that cannot be accessed without mutation.
Note
This module currently does not use in
sink as Phobos does not recognize
them when -preview=in
is used.
Example
import agora .utils .Log;
void myFunction (T) (T data)
{
Logger log = Log .lookup(__MODULE__);
// Supported types: Amount, Hash, Input, Output, Block, Transaction, ...
// If a type is not supported it is returned verbatim
log .info("Got a {} of value: {}", T .stringof, prettify(data));
}
Functions
Name | Description |
---|---|
prettify(input)
|