c++ - Poco::format error -


i'm using poco (v 1.4.6p4) logging framework have problem on formatting strings:

int myclass::mymethod(unsigned short number) {     logger::get("mylog").information(poco::format("log number [%u]", number)); } 

here get:

log number [errfmt] 

and poco::badcastexception thrown.
digging source noted exception thrown class:

template <typename valuetype> valuetype anycast(const any& operand)   /// anycast operator used extract copy of valuetype const any&.   ///   /// example usage:    ///     mytype tmp = anycast<mytype>(anany).   /// throw badcastexception if cast fails.   /// dont use anycast in combination references, i.e. mytype& tmp = ... or const mytype& = ...   /// compilers accept code although copy returned. use refanycast in   /// these cases. {     valuetype* result = anycast<valuetype>(const_cast<any*>(&operand));     if (!result) throw badcastexception("failed convert between const types");     return *result; } 

could tell me wrong?

you have add modifier (h) unsigned short:

poco::format("log number [%hu]", number) 

this annoyance coming any's strictness in extracting values - have ask exact type or else can exception or null pointer.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -