Skip to content

Commit cf08ae2

Browse files
committed
Some simple fixes
1 parent 9afe1b3 commit cf08ae2

File tree

4 files changed

+4
-41
lines changed

4 files changed

+4
-41
lines changed

source/FileLogger.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ namespace vx {
114114
return;
115115
}
116116

117-
std::string output;
117+
std::string output {};
118118
output.reserve( _message.size() + fileOverhead );
119119
output.append( timestamp() );
120120

@@ -153,8 +153,7 @@ namespace vx {
153153
std::shared_lock<std::shared_mutex> lock( m_mutex );
154154

155155
/* check if it should be closed and reopened */
156-
auto now = std::chrono::system_clock::now();
157-
156+
const auto now = std::chrono::system_clock::now();
158157
if ( now - m_lastReopen > m_reopenInterval ) {
159158

160159
m_lastReopen = now;

source/LoggerFactory.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,44 +45,8 @@ namespace vx {
4545
try {
4646

4747
m_creators.try_emplace( "", []( const std::unordered_map<std::string, std::string> &_configuration ) { return std::make_unique<Logger>( _configuration ); } );
48-
}
49-
catch ( [[maybe_unused]] const std::bad_alloc &_exception ) {
50-
51-
/* _exception.what() */
52-
}
53-
catch ( [[maybe_unused]] const std::exception &_exception ) {
54-
55-
/* _exception.what() */
56-
}
57-
58-
try {
59-
6048
m_creators.try_emplace( "std", []( const std::unordered_map<std::string, std::string> &_configuration ) -> std::unique_ptr<Logger> { return std::make_unique<StdLogger>( _configuration ); } );
61-
}
62-
catch ( [[maybe_unused]] const std::bad_alloc &_exception ) {
63-
64-
/* _exception.what() */
65-
}
66-
catch ( [[maybe_unused]] const std::exception &_exception ) {
67-
68-
/* _exception.what() */
69-
}
70-
71-
try {
72-
7349
m_creators.try_emplace( "file", []( const std::unordered_map<std::string, std::string> &_configuration ) -> std::unique_ptr<Logger> { return std::make_unique<FileLogger>( _configuration ); } );
74-
}
75-
catch ( [[maybe_unused]] const std::bad_alloc &_exception ) {
76-
77-
/* _exception.what() */
78-
}
79-
catch ( [[maybe_unused]] const std::exception &_exception ) {
80-
81-
/* _exception.what() */
82-
}
83-
84-
try {
85-
8650
m_creators.try_emplace( "xml", []( const std::unordered_map<std::string, std::string> &_configuration ) -> std::unique_ptr<Logger> { return std::make_unique<XmlFileLogger>( _configuration ); } );
8751
}
8852
catch ( [[maybe_unused]] const std::bad_alloc &_exception ) {

source/StdLogger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace vx {
6060
return;
6161
}
6262

63-
std::string output;
63+
std::string output {};
6464
output.reserve( _message.size() + overhead );
6565
output.append( timestamp() );
6666

source/XmlFileLogger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace vx {
5656
return;
5757
}
5858

59-
std::string output;
59+
std::string output {};
6060
output.reserve( _message.size() + xmlOverhead );
6161
output.append( "<entry>" );
6262
output.append( "<timestamp>" );

0 commit comments

Comments
 (0)