Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
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
submodule
spdlog
Commits
5683c06d
Commit
5683c06d
authored
Jun 13, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solve issue #724
parent
65506136
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
common.h
include/spdlog/common.h
+17
-18
No files found.
include/spdlog/common.h
View file @
5683c06d
...
...
@@ -13,6 +13,7 @@
#include <chrono>
#include <stdexcept>
#include <functional>
#include <algorithm>
#include <initializer_list>
#include <memory>
#include <string>
...
...
@@ -143,31 +144,29 @@ enum class pattern_time_type
//
// Log exception
//
namespace
details
{
namespace
os
{
std
::
string
errno_str
(
int
err_num
);
}
}
// namespace details
class
spdlog_ex
:
public
std
::
runtime_error
{
public
:
spdlog_ex
(
const
std
::
string
&
msg
)
:
runtime_error
(
msg
)
{
fmt
::
format_to
(
buf_
,
"{}"
,
msg
);
}
spdlog_ex
(
const
std
::
string
&
msg
,
int
last_errno
)
:
runtime_error
(
msg
)
{
fmt
::
format_system_error
(
buf_
,
last_errno
,
msg
);
}
explicit
spdlog_ex
(
const
std
::
string
&
msg
)
:
runtime_error
(
msg
){}
spdlog_ex
(
const
std
::
string
&
msg
,
int
last_errno
)
:
runtime_error
(
msg
),
last_errno_
(
last_errno
){}
const
char
*
what
()
const
SPDLOG_NOEXCEPT
override
{
return
fmt
::
to_string
(
buf_
).
c_str
();
if
(
last_errno_
)
{
fmt
::
memory_buffer
buf
;
std
::
string
msg
(
runtime_error
::
what
());
fmt
::
format_system_error
(
buf
,
last_errno_
,
msg
);
return
fmt
::
to_string
(
buf
).
c_str
();
}
else
{
return
runtime_error
::
what
();
}
}
private
:
fmt
::
memory_buffer
buf_
;
int
last_errno_
{
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