You have advised here to use sink with own out stream. I tried to add my own stream but add_ostream method takes shared_ptr<basic_ostream> and my overloads were ignored.
Can You help me? I need to encrypt all formatted message before it will be written to the target file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is only one add_stream method in the text_ostream_backend. It takes a pointer to the stream that you have to create. Your stream will have to do the encryption before writing to the file. This will likely require you to write an encrypting streambuf. Boost.IOStreams may help you with that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have advised here to use sink with own out stream. I tried to add my own stream but add_ostream method takes shared_ptr<basic_ostream> and my overloads were ignored.
Can You help me? I need to encrypt all formatted message before it will be written to the target file.
There is only one add_stream method in the text_ostream_backend. It takes a pointer to the stream that you have to create. Your stream will have to do the encryption before writing to the file. This will likely require you to write an encrypting streambuf. Boost.IOStreams may help you with that.
Thank You so much for a such fast response!
I've found another one solution: I've used my own record formatter and a local copy of formatting_ostream.
void RecordFormatter(logging::record_view const& rec, logging::formatting_ostream& strm)
{
std::string logEntryString;
logging::formatting_ostream formattingStream(logEntryString);
formattingStream << rec[expr::message];
Encrypt(logEntryString);
strm << logEntryString;
}
Last edit: Vasyl Shestak 2014-09-20