@@ -73,10 +73,10 @@ bool ReadStringFromTextFile(const std::string &filename, std::string &content)
7373 std::istreambuf_iterator<char >());
7474 return true ;
7575 } else {
76- LogWarn (" open failed, %s" , filename.c_str ());
76+ LogNotice (" open failed, %s" , filename.c_str ());
7777 }
7878 } catch (const exception &e) {
79- LogWarn (" catch exception: %s" , e.what ());
79+ LogNotice (" catch exception: %s" , e.what ());
8080 }
8181 return false ;
8282}
@@ -94,10 +94,10 @@ bool ReadEachLineFromTextFile(const std::string &filename, const std::function<v
9494 }
9595 return true ;
9696 } else {
97- LogWarn (" open failed, %s" , filename.c_str ());
97+ LogNotice (" open failed, %s" , filename.c_str ());
9898 }
9999 } catch (const exception &e) {
100- LogWarn (" catch exception: %s" , e.what ());
100+ LogNotice (" catch exception: %s" , e.what ());
101101 }
102102 return false ;
103103}
@@ -115,10 +115,10 @@ bool ReadAllLinesFromTextFile(const std::string &filename, std::vector<std::stri
115115 }
116116 return true ;
117117 } else {
118- LogWarn (" open failed, %s" , filename.c_str ());
118+ LogNotice (" open failed, %s" , filename.c_str ());
119119 }
120120 } catch (const exception &e) {
121- LogWarn (" catch exception: %s" , e.what ());
121+ LogNotice (" catch exception: %s" , e.what ());
122122 }
123123 return false ;
124124}
@@ -133,10 +133,10 @@ bool ReadFirstLineFromTextFile(const std::string &filename, std::string &text)
133133 text.pop_back ();
134134 return true ;
135135 } else {
136- LogWarn (" open failed, %s" , filename.c_str ());
136+ LogNotice (" open failed, %s" , filename.c_str ());
137137 }
138138 } catch (const exception &e) {
139- LogWarn (" catch exception: %s" , e.what ());
139+ LogNotice (" catch exception: %s" , e.what ());
140140 }
141141 return false ;
142142}
@@ -181,12 +181,12 @@ bool WriteFile(const char *filename, const void *data_ptr, size_t data_size, boo
181181 return true ;
182182
183183 if (wsize == -1 )
184- LogWarn (" write errno:%d, %s" , errno, strerror (errno));
184+ LogNotice (" write errno:%d, %s" , errno, strerror (errno));
185185 else
186- LogWarn (" wsize:%d, size:%d" , wsize, data_size);
186+ LogNotice (" wsize:%d, size:%d" , wsize, data_size);
187187
188188 } else
189- LogWarn (" open %s failed, %d, %s" , filename, errno, strerror (errno));
189+ LogNotice (" open %s failed, %d, %s" , filename, errno, strerror (errno));
190190
191191 return false ;
192192}
@@ -206,12 +206,12 @@ bool AppendFile(const char *filename, const void *data_ptr, size_t data_size, bo
206206 return true ;
207207
208208 if (wsize == -1 )
209- LogWarn (" write errno:%d, %s" , errno, strerror (errno));
209+ LogNotice (" write errno:%d, %s" , errno, strerror (errno));
210210 else
211- LogWarn (" wsize:%d, size:%d" , wsize, data_size);
211+ LogNotice (" wsize:%d, size:%d" , wsize, data_size);
212212
213213 } else
214- LogWarn (" open %s failed, %d, %s" , filename, errno, strerror (errno));
214+ LogNotice (" open %s failed, %d, %s" , filename, errno, strerror (errno));
215215
216216 return false ;
217217}
@@ -223,7 +223,7 @@ bool RemoveFile(const std::string &filename, bool allow_log_print)
223223 return true ;
224224
225225 if (errno != ENOENT && allow_log_print)
226- LogWarn (" errno:%d (%s)" , errno, strerror (errno));
226+ LogNotice (" errno:%d (%s)" , errno, strerror (errno));
227227
228228 return false ;
229229}
@@ -235,7 +235,7 @@ bool MakeSymbolLink(const std::string &old_path, const std::string &new_path, bo
235235 return true ;
236236
237237 if (allow_log_print)
238- LogWarn (" errno:%d (%s)" , errno, strerror (errno));
238+ LogNotice (" errno:%d (%s)" , errno, strerror (errno));
239239 return false ;
240240}
241241
@@ -246,7 +246,7 @@ bool MakeLink(const std::string &old_path, const std::string &new_path, bool all
246246 return true ;
247247
248248 if (allow_log_print)
249- LogWarn (" errno:%d (%s)" , errno, strerror (errno));
249+ LogNotice (" errno:%d (%s)" , errno, strerror (errno));
250250 return false ;
251251}
252252
@@ -259,7 +259,7 @@ bool MakeDirectory(const std::string &origin_dir_path, bool allow_log_print)
259259{
260260 if (origin_dir_path.empty ()) {
261261 if (allow_log_print)
262- LogWarn (" origin_dir_path is empty" );
262+ LogNotice (" origin_dir_path is empty" );
263263 return false ;
264264 }
265265
@@ -286,18 +286,18 @@ bool MakeDirectory(const std::string &origin_dir_path, bool allow_log_print)
286286 if (errno == ENOENT) { // ! 如果trimmed_dir_path指定的inode不存在,则创建目录
287287 if (::mkdir (trimmed_dir_path.c_str (), 0775 ) != 0 ) {
288288 if (allow_log_print)
289- LogWarn (" mkdir(%s) fail, errno:%d, %s" , trimmed_dir_path.c_str (), errno, strerror (errno));
289+ LogNotice (" mkdir(%s) fail, errno:%d, %s" , trimmed_dir_path.c_str (), errno, strerror (errno));
290290 return false ;
291291 }
292292 } else { // ! 如果是其它的错误
293293 if (allow_log_print)
294- LogWarn (" stat(%s) fail, errno:%d, %s" , trimmed_dir_path.c_str (), errno, strerror (errno));
294+ LogNotice (" stat(%s) fail, errno:%d, %s" , trimmed_dir_path.c_str (), errno, strerror (errno));
295295 return false ;
296296 }
297297 } else { // ! 如果 trimmed_dir_path 指定的inode存在
298298 if (!S_ISDIR (sb.st_mode )) { // ! 该inode并不是一个目录
299299 if (allow_log_print)
300- LogWarn (" inode %s is not directory" , trimmed_dir_path.c_str ());
300+ LogNotice (" inode %s is not directory" , trimmed_dir_path.c_str ());
301301 return false ;
302302 }
303303 // ! 存在,且是目录,则不做任何事件
@@ -315,9 +315,9 @@ bool RemoveDirectory(const std::string &dir, bool is_remove_file_only)
315315 if (dp == nullptr ) {
316316 // 无法打开目录,直接结束
317317 if (errno == ENOENT) {
318- LogWarn (" directory %s does not exist" , dir.c_str ());
318+ LogNotice (" directory %s does not exist" , dir.c_str ());
319319 } else {
320- LogWarn (" open directory %s fail, errno:%d, %s" , dir.c_str (), errno, strerror (errno));
320+ LogNotice (" open directory %s fail, errno:%d, %s" , dir.c_str (), errno, strerror (errno));
321321 }
322322 return false ;
323323 }
@@ -346,21 +346,21 @@ bool RemoveDirectory(const std::string &dir, bool is_remove_file_only)
346346 } else {
347347 // 属性为文件,直接删除文件
348348 if (::remove (full_path.c_str ())) {
349- LogWarn (" removing file %s fail, errno:%d, %s" , full_path.c_str (), errno, strerror (errno));
349+ LogNotice (" removing file %s fail, errno:%d, %s" , full_path.c_str (), errno, strerror (errno));
350350 is_all_removed = false ;
351351 }
352352 }
353353 } else {
354354 // 无法获取属性,直接结束
355- LogWarn (" getting state of %s fail, errno:%d, %s" , full_path.c_str (), errno, strerror (errno));
355+ LogNotice (" getting state of %s fail, errno:%d, %s" , full_path.c_str (), errno, strerror (errno));
356356 is_all_removed = false ;
357357 }
358358 }
359359
360360 if (!is_remove_file_only) {
361361 // 最后删除目录
362362 if (::rmdir (dir.c_str ())) {
363- LogWarn (" removing directory %s fail, errno:%d, %s" , dir.c_str (), errno, strerror (errno));
363+ LogNotice (" removing directory %s fail, errno:%d, %s" , dir.c_str (), errno, strerror (errno));
364364 is_all_removed = false ;
365365 }
366366 }
@@ -374,9 +374,9 @@ bool ListDirectory(const std::string &dir, std::vector<std::string> &names)
374374 if (dp == nullptr ) {
375375 // 无法打开目录,直接结束
376376 if (errno == ENOENT) {
377- LogWarn (" directory %s does not exist" , dir.c_str ());
377+ LogNotice (" directory %s does not exist" , dir.c_str ());
378378 } else {
379- LogWarn (" open directory %s fail, errno:%d, %s" , dir.c_str (), errno, strerror (errno));
379+ LogNotice (" open directory %s fail, errno:%d, %s" , dir.c_str (), errno, strerror (errno));
380380 }
381381 return false ;
382382 }
@@ -492,7 +492,7 @@ bool Rename(const std::string &old_name, const std::string &new_name)
492492 if (ret == 0 )
493493 return true ;
494494
495- LogWarn (" rename '%s' to '%s' fail, errno:%d (%s)" ,
495+ LogNotice (" rename '%s' to '%s' fail, errno:%d (%s)" ,
496496 old_name.c_str (), new_name.c_str (), errno, strerror (errno));
497497 return false ;
498498}
0 commit comments