Log wchar_t*

Please post support and help requests here.
roelvz
Posts: 2
Joined: 25 Jan 2017, 21:35

Log wchar_t*

Postby roelvz » 09 Oct 2017, 11:45

What is the correct way to log a wchar_t* using the logger?

guenter
Posts: 1268
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Log wchar_t*

Postby guenter » 09 Oct 2017, 22:52

The logging framework currently does not support wchar_t* (or char*, for that matter). Need to convert to a std::string first. You can use Poco::UnicodeConverter to convert from wchar_t* to std::string, under the assumption that the characters in wchar_t* use UTF-16 encoding (as on Windows, where wchar_t is 16 bits wide) or UTF-32 (on platforms where wchar_t is 32 bits wide).

roelvz
Posts: 2
Joined: 25 Jan 2017, 21:35

Re: Log wchar_t*

Postby roelvz » 11 Oct 2017, 16:17

Thanks for the answer.

I just discovered Poco::LogStream. With this I can easily log wchar_t* using the << operator.

Is there any reason why I would prefer Poco::Logger over Poco::LogStream? If not I think Poco::LogStream is more convenient to use and I prefer to use it.


Return to “Support”

Who is online

Users browsing this forum: No registered users and 6 guests

cron