diff options
author | claiff <claiff@mail.ru> | 2022-09-23 16:16:56 +0300 |
---|---|---|
committer | claiff <claiff@mail.ru> | 2022-09-23 16:16:56 +0300 |
commit | b8c1b47e32215cfa9f0483144ee643867ffc67c7 (patch) | |
tree | 5a37659a3df70b30eaa1f66d5b3b2c7a60bf75aa /src/file/mail.cpp | |
parent | ee8c175e9eae4faccdf913578fb30d09c200204f (diff) | |
download | obmc-sila-smtp-b8c1b47e32215cfa9f0483144ee643867ffc67c7.tar.xz |
add phosphor loggerfeature/logger
Diffstat (limited to 'src/file/mail.cpp')
-rw-r--r-- | src/file/mail.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/file/mail.cpp b/src/file/mail.cpp index cf5fe26..2a2231b 100644 --- a/src/file/mail.cpp +++ b/src/file/mail.cpp @@ -13,10 +13,12 @@ namespace smtp::file manage::MailsSet Mail::Read() const { + static const std::string METHOD_NAME = "Read mails"; + std::ifstream mail_file{ mPathFile, std::fstream::in }; if ( !mail_file.is_open() ) { - manage::Logger::LogError( "Unable to open file to read " + mPathFile ); + logger::LoggerSet::GetInstance()->LogError( METHOD_NAME, "Unable to open file to read " + mPathFile ); return {}; } std::string line{}; @@ -35,10 +37,12 @@ namespace smtp::file bool Mail::Write( manage::MailsSet const& data ) const { + static const std::string METHOD_NAME = "Write mails"; + std::ofstream mail_file{ mPathFile, std::fstream::out | std::fstream::trunc }; if ( !mail_file.is_open() ) { - manage::Logger::LogError( "Unable to open file to write " + mPathFile ); + logger::LoggerSet::GetInstance()->LogError( METHOD_NAME, "Unable to open file to write " + mPathFile ); return false; } for( const auto& mail : data ) |