Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
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
董子豪
sgxwallet
Commits
86e8b271
Unverified
Commit
86e8b271
authored
May 06, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed docs
parent
c10e1191
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
126 deletions
+82
-126
Log.cpp
Log.cpp
+6
-6
Log.h
Log.h
+17
-8
SGXWalletServer.cpp
SGXWalletServer.cpp
+59
-112
No files found.
Log.cpp
View file @
86e8b271
...
@@ -24,20 +24,15 @@
...
@@ -24,20 +24,15 @@
#include "spdlog/spdlog.h"
#include "spdlog/spdlog.h"
#include "sgxwallet_common.h"
#include "sgxwallet_common.h"
#include "common.h"
#include "common.h"
#include "SGXException.h"
#include "Log.h"
#include "Log.h"
using
namespace
std
;
using
namespace
std
;
void
Log
::
setGlobalLogLevel
(
string
&
_s
)
{
void
Log
::
setGlobalLogLevel
(
string
&
_s
)
{
globalLogLevel
=
logLevelFromString
(
_s
);
globalLogLevel
=
logLevelFromString
(
_s
);
}
}
level_enum
Log
::
logLevelFromString
(
string
&
_s
)
{
level_enum
Log
::
logLevelFromString
(
string
&
_s
)
{
level_enum
result
=
trace
;
level_enum
result
=
trace
;
...
@@ -58,6 +53,11 @@ level_enum Log::logLevelFromString(string &_s) {
...
@@ -58,6 +53,11 @@ level_enum Log::logLevelFromString(string &_s) {
}
}
void
Log
::
handleSGXException
(
Json
::
Value
&
_result
,
SGXException
&
_e
)
{
spdlog
::
error
(
"Responding with JSON error:"
+
_e
.
errString
);
_result
[
"status"
]
=
_e
.
status
;
_result
[
"errorMessage"
]
=
_e
.
errString
;
}
Log.h
View file @
86e8b271
...
@@ -30,7 +30,11 @@
...
@@ -30,7 +30,11 @@
#include <map>
#include <map>
#include <memory>
#include <memory>
#include "json/json.h"
#include "spdlog/spdlog.h"
#include "SGXException.h"
#include "InvalidArgumentException.h"
#include "InvalidArgumentException.h"
#include "InvalidStateException.h"
#include "InvalidStateException.h"
...
@@ -39,21 +43,18 @@
...
@@ -39,21 +43,18 @@
using
namespace
std
;
using
namespace
std
;
class
Exception
;
class
Exception
;
#define __CLASS_NAME__ className( __PRETTY_FUNCTION__ )
#define __CLASS_NAME__ className( __PRETTY_FUNCTION__ )
#define LOG(
__SEVERITY__, __MESSAGE__
) \
#define LOG(
__SEVERITY__, __MESSAGE__
) \
cerr << to_string(__SEVERITY__) << " " << __MESSAGE__ << " " << className( __PRETTY_FUNCTION__ ) << endl;
cerr << to_string(__SEVERITY__) << " " << __MESSAGE__ << " " << className( __PRETTY_FUNCTION__ ) << endl;
enum
level_enum
{
trace
,
debug
,
info
,
warn
,
err
enum
level_enum
{
trace
,
debug
,
info
,
warn
,
err
};
};
class
Log
{
class
Log
{
...
@@ -62,8 +63,16 @@ public:
...
@@ -62,8 +63,16 @@ public:
level_enum
globalLogLevel
;
level_enum
globalLogLevel
;
void
setGlobalLogLevel
(
string
&
_s
);
void
setGlobalLogLevel
(
string
&
_s
);
static
level_enum
logLevelFromString
(
string
&
_s
);
static
level_enum
logLevelFromString
(
string
&
_s
);
static
void
handleSGXException
(
Json
::
Value
&
_result
,
SGXException
&
_e
);
};
};
#define INIT_RESULT(__RESULT__) Json::Value __RESULT__; __RESULT__["status"] = 0; __RESULT__["errorMessage"] = "";
#define HANDLE_SGX_EXCEPTION(_RESULT_) catch (SGXException &__e) { Log::handleSGXException(_RESULT_, __e);}
#define LOCK(__M__) lock_guard<recursive_mutex> lock(__M__);
#endif
#endif
SGXWalletServer.cpp
View file @
86e8b271
This diff is collapsed.
Click to expand it.
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