Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
denpends
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xueyimeng
denpends
Commits
130f0b45
Commit
130f0b45
authored
Feb 22, 2022
by
xueyimeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善代码
parent
71d1ea27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
31 deletions
+19
-31
Reporter.cpp
cloud_common/utility/Reporter.cpp
+0
-28
Reporter.h
cloud_common/utility/Reporter.h
+19
-3
No files found.
cloud_common/utility/Reporter.cpp
deleted
100644 → 0
View file @
71d1ea27
//
// Created by xueyimeng on 21-9-17.
//
#include "Reporter.h"
#include <fstream>
FileReporter
::~
FileReporter
()
{
if
(
fs
.
is_open
())
{
fs
.
close
();
}
}
FileReporter
::
FileReporter
(
const
std
::
string
&
result_pathname
)
{
this
->
result_pathname
=
result_pathname
;
if
(
!
fs
.
is_open
())
{
fs
.
open
(
result_pathname
.
c_str
());
}
}
void
FileReporter
::
report
(
const
std
::
string
&
message
)
{
if
(
fs
.
is_open
())
{
mutex
.
lock
();
fs
<<
message
<<
std
::
endl
;
mutex
.
unlock
();
}
}
\ No newline at end of file
cloud_common/utility/Reporter.h
View file @
130f0b45
...
...
@@ -25,11 +25,27 @@ class FileReporter : public Reporter {
protected
:
FileReporter
()
{}
public
:
FileReporter
(
const
std
::
string
&
reporter
);
virtual
~
FileReporter
();
FileReporter
(
const
std
::
string
&
reporter
)
{
this
->
result_pathname
=
reporter
;
if
(
!
fs
.
is_open
())
{
fs
.
open
(
result_pathname
.
c_str
());
}
}
virtual
~
FileReporter
()
{
if
(
fs
.
is_open
())
{
fs
.
close
();
}
}
public
:
virtual
void
report
(
const
std
::
string
&
message
);
virtual
void
report
(
const
std
::
string
&
message
)
{
if
(
fs
.
is_open
())
{
mutex
.
lock
();
fs
<<
message
<<
std
::
endl
;
mutex
.
unlock
();
}
}
private
:
...
...
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