Boost logo

Boost Users :

Subject: [Boost-users] [logging] operator<< not called if logger initialized by init_from_settings()
From: Eric Prud'hommeaux (eric_at_[hidden])
Date: 2013-08-25 06:56:41


Following the standard recipe for a severity logger, I failed to get a
logger configured by parsing a settings file to property invoke the
operator<< for the severity. I tested by creating two logs, one by
parsing and one by explicit construction (attached). Below, the former
(starting with "parse: ") does not call the operator<< while the
latter (staring with (const: ") does:
[[
parse: : <> normal 1
severity_enum.cpp:25: operator<<(0x164dce0, 0)
const: : <normal> normal 1
parse: : <> criticial 2
severity_enum.cpp:25: operator<<(0x164dce0, 1)
const: : <critical> criticial 2
]]

It also doesn't matter whether the explicitly constructed logger is
before the parsed logger:
[[
severity_enum.cpp:25: operator<<(0x20b5d40, 0)
const: : <normal> normal 1
parse: : <> normal 1
severity_enum.cpp:25: operator<<(0x20b5d40, 1)
const: : <critical> criticial 2
parse: : <> criticial 2
]]

I've also tested this with a severity_channel logger with the same
result.

  typedef unsigned int severity_level; (and some #defines)
shows that the specialized operator<<(..., severity_level) isn't
called at all, but at least the std:: one prints integers:
[[
parse: : <0> normal 1
const: : <0> normal 1
parse: : <1> criticial 2
const: : <1> criticial 2
]]

I haven't worked out how to construct a settings object directly (as
opposed to using the setting parser). I guess that's the next test.

-- 
-ericP





Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net