Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
HelloWorld
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZhongJianfu
HelloWorld
Commits
49ac57da
Commit
49ac57da
authored
Mar 25, 2022
by
ZhongJianfu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:更新
parent
e9f3a382
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
12 deletions
+28
-12
my_easylogging.cpp
feature/easylogging/my_easylogging.cpp
+6
-3
my_easylogging.h
feature/easylogging/my_easylogging.h
+1
-0
log.conf
log/log.conf
+8
-7
main.cpp
main.cpp
+13
-2
No files found.
feature/easylogging/my_easylogging.cpp
View file @
49ac57da
#include "my_easylogging.h"
#include "my_easylogging.h"
// #include <ctime>
using
namespace
std
;
using
namespace
std
;
INT32
G_LOG_ENABLE
=
0
;
//调试中的变量,写0就好了。写1则开启相应打印
INT32
G_LOG_ENABLE
=
0
;
//调试中的变量,写0就好了。写1则开启相应打印
...
@@ -54,10 +56,11 @@ void rolloutHandler(const char *filename, std::size_t size)
...
@@ -54,10 +56,11 @@ void rolloutHandler(const char *filename, std::size_t size)
replace
(
cc
.
begin
(),
cc
.
end
(),
'/'
,
'\\'
);
replace
(
cc
.
begin
(),
cc
.
end
(),
'/'
,
'\\'
);
system
(
cc
.
c_str
());
system
(
cc
.
c_str
());
#else
#else
/*下面这段没有测试过*/
/*下面这段没有测试过
需要优化
*/
system
(
"mkdir bin"
);
//
system("mkdir bin");
std
::
stringstream
ss
;
std
::
stringstream
ss
;
ss
<<
"move "
<<
filename
<<
" bin
\\
log_backup_"
<<
++
idx
;
ss
<<
"mv "
<<
filename
<<
" ./log/log_backup_"
<<
++
idx
;
system
(
ss
.
str
().
c_str
());
system
(
ss
.
str
().
c_str
());
#endif
#endif
}
}
...
...
feature/easylogging/my_easylogging.h
View file @
49ac57da
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define _MY_EASYLOGGING_H_
#define _MY_EASYLOGGING_H_
#include "inc/easylogging++.h"
#include "inc/easylogging++.h"
#include "normal_typedef.h"
#include "normal_typedef.h"
#include <iostream>
enum
LEVEL
enum
LEVEL
{
{
...
...
log/log.conf
View file @
49ac57da
...
@@ -4,23 +4,24 @@
...
@@ -4,23 +4,24 @@
TO_FILE
=
true
TO_FILE
=
true
TO_STANDARD_OUTPUT
=
false
TO_STANDARD_OUTPUT
=
false
PERFORMANCE_TRACKING
=
false
PERFORMANCE_TRACKING
=
false
MAX_LOG_FILE_SIZE
=
209715200
MAX_LOG_FILE_SIZE
=
1
FILENAME
=
"./log/info_%datetime{%Y%M%d}.log"
FILENAME
=
"./log/info_%datetime{%Y%M%d}.log"
*
INFO
:
*
INFO
:
FORMAT
=
"%datetime
%msg"
FORMAT
=
"%datetime
:[%level]
%msg"
ENABLED
=
true
ENABLED
=
true
TO_STANDARD_OUTPUT
=
true
TO_STANDARD_OUTPUT
=
true
*
DEBUG
:
*
DEBUG
:
FORMAT
=
"%datetime:[%level] %func[%line] %msg"
FORMAT
=
"%datetime:[%level] %func[%line] %msg"
ENABLED
=
true
ENABLED
=
true
TO_STANDARD_OUTPUT
=
true
*
WARNING
:
*
WARNING
:
ENABLED
=
true
ENABLED
=
true
*
TRACE
:
*
TRACE
:
ENABLED
=
fals
e
ENABLED
=
tru
e
FILENAME
=
"./log/trace_%datetime{%Y%M%d}.log"
FILENAME
=
"./log/trace_%datetime{%Y%M%d}.log"
...
@@ -29,10 +30,10 @@
...
@@ -29,10 +30,10 @@
ENABLED
=
true
ENABLED
=
true
*
ERROR
:
*
ERROR
:
FORMAT
=
"%datetime:[%level] %msg"
FORMAT
=
"%datetime:[%level] %
func[%line] %
msg"
ENABLED
=
true
ENABLED
=
true
TO_STANDARD_OUTPUT
=
true
TO_STANDARD_OUTPUT
=
true
*
FATAL
:
*
FATAL
:
ENABLED
=
true
ENABLED
=
true
TO_STANDARD_OUTPUT
=
true
TO_STANDARD_OUTPUT
=
true
main.cpp
View file @
49ac57da
...
@@ -7,12 +7,24 @@
...
@@ -7,12 +7,24 @@
int
main
()
int
main
()
{
{
easylogginginit
();
//日志初始化
easylogginginit
();
//日志初始化
log_test
();
//日志自测函数
log_test
();
//日志自测函数
里面可以看细节的用法
printf
(
"Hello world
\n\r
"
);
printf
(
"Hello world
\n\r
"
);
test1
();
test1
();
test2
();
test2
();
#if 0
while (1)
{
LOG(INFO) << "》》》》》》》》》》打印测试11111《《《《《《《《";
// sleep(1);//秒
usleep(1 * 1000); //微秒
// printf("HDDD not def\n\r");
// std::cout << "An exception occurred. Exception Nr. " << std::endl;
LOG(INFO) << "》》》》》》》》》》打印测试《《《《《《《《";
LOG(INFO) << "》》》》》》》》》》打印测试2222《《《《《《《《";
}
#endif
try
try
{
{
throw
20
;
throw
20
;
...
@@ -27,7 +39,6 @@ int main()
...
@@ -27,7 +39,6 @@ int main()
#else
#else
printf
(
"HDDD not def
\n\r
"
);
printf
(
"HDDD not def
\n\r
"
);
// std::cout << HDDD << std::endl;
// std::cout << HDDD << std::endl;
#endif // #
#endif // #
return
0
;
return
0
;
...
...
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