www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.experimental.logger + threadIds

reply =?UTF-8?Q?Christian_K=c3=b6stlin?= <christian.koestlin gmail.com> writes:
I am experimenting with the logger interface and want to write a custom
logger, that also outputs the threadID or Tid of the LogEntries.
The documentation shows how to do a custom logger, but I am unable to
convert the threadId to a string, because all conversion functions are
not  safe.

Is there a way around this?

Thanks in advance,
Christian
Dec 19 2016
parent reply Robert burner Schadek <rburners gmail.com> writes:
The ugly way is to create a  trusted function/lambda that coverts 
the threadId to a string.

Not sure about the pretty way.
Dec 19 2016
parent =?UTF-8?Q?Christian_K=c3=b6stlin?= <christian.koestlin gmail.com> writes:
On 19/12/2016 21:32, Robert burner Schadek wrote:
 The ugly way is to create a  trusted function/lambda that coverts the
 threadId to a string.
 
 Not sure about the pretty way.
thanks a lot. works good enough, just for reference, I added: string tid2string(Tid id) trusted { import std.conv : text; return text(id); }
Dec 19 2016