Hi Thuan, Thanks for your comment.
Best Regards, ThienHuynh -----Original Message----- From: Thuan Tran <thuan.t...@dektech.com.au> Sent: Tuesday, April 7, 2020 6:51 PM To: Vu Minh Nguyen <vu.m.ngu...@dektech.com.au>; Thien Minh Huynh <thien.m.hu...@dektech.com.au> Cc: opensaf-devel@lists.sourceforge.net Subject: RE: [PATCH 1/1] log: log content is placed in a file of another stream [#3175] Hi Thien, ACK with minor comment inline. Best Regards, ThuanTr -----Original Message----- From: Vu Minh Nguyen <vu.m.ngu...@dektech.com.au> Sent: Tuesday, April 7, 2020 5:27 PM To: Thien Minh Huynh <thien.m.hu...@dektech.com.au>; Thuan Tran <thuan.t...@dektech.com.au> Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 1/1] log: log content is placed in a file of another stream [#3175] Ack. Regards, Vu On 4/7/20 4:33 PM, thien.m.huynh wrote: > --- > src/log/logd/lgs_filehdl.cc | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/src/log/logd/lgs_filehdl.cc b/src/log/logd/lgs_filehdl.cc > index 0d7fb2b74..362df4c27 100644 > --- a/src/log/logd/lgs_filehdl.cc > +++ b/src/log/logd/lgs_filehdl.cc > @@ -26,6 +26,7 @@ > #include <sys/stat.h> > #include <unistd.h> > #include <string> > +#include <regex> > > #include "base/logtrace.h" > #include "base/osaf_time.h" > @@ -964,13 +965,13 @@ static int chr_cnt_b(char *str, char c, int lim) { > /* Filename prefix (no timestamps or extension */ > static std::string file_name_find_g; > static int filter_logfile_name(const struct dirent *finfo) { > - int found = 0; > - > - if ((strstr(finfo->d_name, file_name_find_g.c_str()) != nullptr) && > - (strstr(finfo->d_name, ".log") != nullptr)) > - found = 1; > - > - return found; > + const std::string pattern = > + "^" + file_name_find_g + "_[0-9]{8}_[0-9]{6}.log$"; const > + std::regex e{pattern}; if (std::regex_match(finfo->d_name, e)) { > + return true; > + } > + return false; [Thuan] use return value 0/1 as before (match function prototype). > } > > /** _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel