Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FaceDetection
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanghui.cui
FaceDetection
Commits
9e504b33
Commit
9e504b33
authored
Mar 15, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加日志管理模块
parent
657616e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
FaceDetection/FaceDetection.cpp
+26
-0
Release/log.conf
+32
-0
No files found.
FaceDetection/FaceDetection.cpp
View file @
9e504b33
...
...
@@ -93,6 +93,17 @@ void get_userinfo_by_phone(IN const string &phone, OUT adStruct &info);
// 广告播放推送
CURLcode
curl_post_ad
(
const
string
&
url
,
const
string
equipmentId
,
const
string
productId
,
string
&
response
);
void
logRolloutHandler
(
const
char
*
filename
,
std
::
size_t
size
)
{
/// 备份日志
//std::string strLogPath = GetProcDir();
//strLogPath.append(filename);
std
::
cout
<<
"bk filename:"
<<
filename
<<
std
::
endl
;
std
::
stringstream
ss
;
ss
<<
"mv "
<<
filename
<<
" "
<<
filename
<<
"_bk"
;
system
(
ss
.
str
().
c_str
());
}
/****************************************
主函数
****************************************/
...
...
@@ -100,6 +111,17 @@ int main(int argc, char** argv)
{
try
{
// 初始化日志
el
::
Loggers
::
addFlag
(
el
::
LoggingFlag
::
StrictLogFileSizeCheck
);
std
::
string
strBinPath
=
GetProcDir
();
std
::
string
strLogPath
(
strBinPath
.
data
());
strLogPath
.
append
(
"log.conf"
);
el
::
Configurations
conf
(
strLogPath
.
data
());
/// 设置全部logger的配置
el
::
Loggers
::
reconfigureAllLoggers
(
conf
);
/// 注册回调函数
el
::
Helpers
::
installPreRollOutCallback
(
logRolloutHandler
);
LOG
(
INFO
)
<<
"**************START PROCESS****************"
;
// 读取配置文件信息
std
::
string
strIniPath
=
GetProcDir
();
...
...
@@ -250,6 +272,9 @@ int main(int argc, char** argv)
// global release
curl_global_cleanup
();
// 注销回调函数
el
::
Helpers
::
uninstallPreRollOutCallback
();
return
0
;
}
...
...
@@ -386,6 +411,7 @@ void reqUserInfoByImg(int index, string &imgPath)
std
::
string
postAdResponseStr
;
curl_post_ad
(
strAdUrl
,
strDeviceId
,
adInfo
.
goodsId
,
postAdResponseStr
);
//curl_post_ad(strAdUrl,"6739c9fa37f547ef916d06d33a73331a","80052478", postAdResponseStr);
LOG
(
INFO
)
<<
"push data device_id:"
<<
strDeviceId
.
data
()
<<
" goods_id:"
<<
adInfo
.
goodsId
.
data
();
LOG
(
INFO
)
<<
"ad push response:"
<<
postAdResponseStr
.
data
();
}
}
...
...
Release/log.conf
0 → 100644
View file @
9e504b33
*
GLOBAL
:
ENABLED
=
true
TO_FILE
=
true
TO_STANDARD_OUTPUT
=
true
FORMAT
=
"[%level | %datetime] | %msg"
FILENAME
=
"./logs/log.log"
MILLISECONDS_WIDTH
=
3
PERFORMANCE_TRACKING
=
false
MAX_LOG_FILE_SIZE
=
10485760
LOG_FLUSH_THRESHOLD
=
10
*
TRACE
:
FILENAME
=
"./logs/trace_log.log"
*
DEBUG
:
FILENAME
=
"./logs/debug_log.log"
*
FATAL
:
ENABLED
=
false
*
ERROR
:
FILENAME
=
"./logs/error_log.log"
*
WARNING
:
FILENAME
=
"./logs/warning_log.log"
*
INFO
:
FILENAME
=
"./logs/info_log.log"
*
VERBOSE
:
ENABLED
=
false
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment