0

How to call sink->imbue for text file sink when using init_from_settings? I checked the source code and didn't find a way to re-access those sinks.

Seems that register_sink_factory is the extension, but the default factories are all in init_from_settings.cpp, so I'm not able to use an a decorator pattern to implement it easily.

I tried was set global locale, but it breaks RotationSize param (which doesn't accept int with decimal point)

Another way is:

auto previousLocale = std::locale::global(boost::locale::generator()("zh_CN.UTF-8"));
logging::init_from_settings(settings);
logging::add_common_attributes();
std::locale::global(previousLocale);

Any better ideas?

user1633272
  • 2,007
  • 5
  • 25
  • 48

1 Answers1

0

You can register a sink factory that will configure the sink the way you need. You can find an example here.

Andrey Semashev
  • 10,046
  • 1
  • 17
  • 27