Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
2400cf16
Commit
2400cf16
authored
Mar 22, 2020
by
gabime
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-#1483' into v1.x
parents
bbe3ace5
3b87eb3d
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
32 additions
and
19 deletions
+32
-19
include/spdlog/async_logger-inl.h
include/spdlog/async_logger-inl.h
+2
-2
include/spdlog/common-inl.h
include/spdlog/common-inl.h
+10
-0
include/spdlog/common.h
include/spdlog/common.h
+3
-1
include/spdlog/details/file_helper-inl.h
include/spdlog/details/file_helper-inl.h
+4
-4
include/spdlog/details/os-inl.h
include/spdlog/details/os-inl.h
+3
-2
include/spdlog/details/registry-inl.h
include/spdlog/details/registry-inl.h
+1
-1
include/spdlog/details/tcp_client-windows.h
include/spdlog/details/tcp_client-windows.h
+1
-1
include/spdlog/details/thread_pool-inl.h
include/spdlog/details/thread_pool-inl.h
+2
-2
include/spdlog/sinks/android_sink.h
include/spdlog/sinks/android_sink.h
+1
-1
include/spdlog/sinks/daily_file_sink.h
include/spdlog/sinks/daily_file_sink.h
+2
-2
include/spdlog/sinks/systemd_sink.h
include/spdlog/sinks/systemd_sink.h
+1
-1
include/spdlog/sinks/win_eventlog_sink.h
include/spdlog/sinks/win_eventlog_sink.h
+1
-1
include/spdlog/sinks/wincolor_sink-inl.h
include/spdlog/sinks/wincolor_sink-inl.h
+1
-1
No files found.
include/spdlog/async_logger-inl.h
View file @
2400cf16
...
...
@@ -32,7 +32,7 @@ SPDLOG_INLINE void spdlog::async_logger::sink_it_(const details::log_msg &msg)
}
else
{
SPDLOG_THROW
(
spdlog_ex
(
"async log: thread pool doesn't exist anymore"
)
);
throw_spdlog_ex
(
"async log: thread pool doesn't exist anymore"
);
}
}
...
...
@@ -45,7 +45,7 @@ SPDLOG_INLINE void spdlog::async_logger::flush_()
}
else
{
SPDLOG_THROW
(
spdlog_ex
(
"async flush: thread pool doesn't exist anymore"
)
);
throw_spdlog_ex
(
"async flush: thread pool doesn't exist anymore"
);
}
}
...
...
include/spdlog/common-inl.h
View file @
2400cf16
...
...
@@ -63,4 +63,14 @@ SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT
return
msg_
.
c_str
();
}
SPDLOG_INLINE
void
throw_spdlog_ex
(
const
std
::
string
&
msg
,
int
last_errno
)
{
SPDLOG_THROW
(
spdlog_ex
(
msg
,
last_errno
));
}
SPDLOG_INLINE
void
throw_spdlog_ex
(
std
::
string
msg
)
{
SPDLOG_THROW
(
spdlog_ex
(
std
::
move
(
msg
)));
}
}
// namespace spdlog
include/spdlog/common.h
View file @
2400cf16
...
...
@@ -204,6 +204,9 @@ private:
std
::
string
msg_
;
};
void
throw_spdlog_ex
(
const
std
::
string
&
msg
,
int
last_errno
);
void
throw_spdlog_ex
(
std
::
string
msg
);
struct
source_loc
{
SPDLOG_CONSTEXPR
source_loc
()
=
default
;
...
...
@@ -236,7 +239,6 @@ std::unique_ptr<T> make_unique(Args &&... args)
}
#endif
}
// namespace details
}
// namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
...
...
include/spdlog/details/file_helper-inl.h
View file @
2400cf16
...
...
@@ -43,14 +43,14 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
details
::
os
::
sleep_for_millis
(
open_interval_
);
}
SPDLOG_THROW
(
spdlog_ex
(
"Failed opening file "
+
os
::
filename_to_str
(
filename_
)
+
" for writing"
,
errno
)
);
throw_spdlog_ex
(
"Failed opening file "
+
os
::
filename_to_str
(
filename_
)
+
" for writing"
,
errno
);
}
SPDLOG_INLINE
void
file_helper
::
reopen
(
bool
truncate
)
{
if
(
filename_
.
empty
())
{
SPDLOG_THROW
(
spdlog_ex
(
"Failed re opening file - was not opened before"
)
);
throw_spdlog_ex
(
"Failed re opening file - was not opened before"
);
}
this
->
open
(
filename_
,
truncate
);
}
...
...
@@ -75,7 +75,7 @@ SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf)
auto
data
=
buf
.
data
();
if
(
std
::
fwrite
(
data
,
1
,
msg_size
,
fd_
)
!=
msg_size
)
{
SPDLOG_THROW
(
spdlog_ex
(
"Failed writing to file "
+
os
::
filename_to_str
(
filename_
),
errno
)
);
throw_spdlog_ex
(
"Failed writing to file "
+
os
::
filename_to_str
(
filename_
),
errno
);
}
}
...
...
@@ -83,7 +83,7 @@ SPDLOG_INLINE size_t file_helper::size() const
{
if
(
fd_
==
nullptr
)
{
SPDLOG_THROW
(
spdlog_ex
(
"Cannot use size() on closed file "
+
os
::
filename_to_str
(
filename_
)
));
throw_spdlog_ex
(
"Cannot use size() on closed file "
+
os
::
filename_to_str
(
filename_
));
}
return
os
::
filesize
(
fd_
);
}
...
...
include/spdlog/details/os-inl.h
View file @
2400cf16
...
...
@@ -204,7 +204,7 @@ SPDLOG_INLINE size_t filesize(FILE *f)
{
if
(
f
==
nullptr
)
{
SPDLOG_THROW
(
spdlog_ex
(
"Failed getting file size. fd is null"
)
);
throw_spdlog_ex
(
"Failed getting file size. fd is null"
);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
int
fd
=
::
_fileno
(
f
);
...
...
@@ -245,7 +245,8 @@ SPDLOG_INLINE size_t filesize(FILE *f)
}
#endif
#endif
SPDLOG_THROW
(
spdlog_ex
(
"Failed getting file size from fd"
,
errno
));
throw_spdlog_ex
(
"Failed getting file size from fd"
,
errno
);
return
0
;
// will not be reached.
}
// Return utc offset in minutes or throw spdlog_ex on failure
...
...
include/spdlog/details/registry-inl.h
View file @
2400cf16
...
...
@@ -284,7 +284,7 @@ SPDLOG_INLINE void registry::throw_if_exists_(const std::string &logger_name)
{
if
(
loggers_
.
find
(
logger_name
)
!=
loggers_
.
end
())
{
SPDLOG_THROW
(
spdlog_ex
(
"logger with name '"
+
logger_name
+
"' already exists"
)
);
throw_spdlog_ex
(
"logger with name '"
+
logger_name
+
"' already exists"
);
}
}
...
...
include/spdlog/details/tcp_client-windows.h
View file @
2400cf16
...
...
@@ -55,7 +55,7 @@ class tcp_client
::
FormatMessage
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_IGNORE_INSERTS
,
NULL
,
last_error
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
buf
,
(
sizeof
(
buf
)
/
sizeof
(
char
)),
NULL
);
SPDLOG_THROW
(
spdlog_ex
(
fmt
::
format
(
"tcp_sink - {}: {}"
,
msg
,
buf
)
));
throw_spdlog_ex
(
fmt
::
format
(
"tcp_sink - {}: {}"
,
msg
,
buf
));
}
public:
...
...
include/spdlog/details/thread_pool-inl.h
View file @
2400cf16
...
...
@@ -18,8 +18,8 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, size_t threads_n, std
{
if
(
threads_n
==
0
||
threads_n
>
1000
)
{
SPDLOG_THROW
(
spdlog_ex
(
"spdlog::thread_pool(): invalid threads_n param (valid "
"range is 1-1000)"
)
)
;
throw_
spdlog_ex
(
"spdlog::thread_pool(): invalid threads_n param (valid "
"range is 1-1000)"
);
}
for
(
size_t
i
=
0
;
i
<
threads_n
;
i
++
)
{
...
...
include/spdlog/sinks/android_sink.h
View file @
2400cf16
...
...
@@ -64,7 +64,7 @@ protected:
if
(
ret
<
0
)
{
SPDLOG_THROW
(
spdlog_ex
(
"__android_log_write() failed"
,
ret
)
);
throw_spdlog_ex
(
"__android_log_write() failed"
,
ret
);
}
}
...
...
include/spdlog/sinks/daily_file_sink.h
View file @
2400cf16
...
...
@@ -56,7 +56,7 @@ public:
{
if
(
rotation_hour
<
0
||
rotation_hour
>
23
||
rotation_minute
<
0
||
rotation_minute
>
59
)
{
SPDLOG_THROW
(
spdlog_ex
(
"daily_file_sink: Invalid rotation time in ctor"
)
);
throw_spdlog_ex
(
"daily_file_sink: Invalid rotation time in ctor"
);
}
auto
now
=
log_clock
::
now
();
...
...
@@ -164,7 +164,7 @@ private:
if
(
!
ok
)
{
filenames_q_
.
push_back
(
std
::
move
(
current_file
));
SPDLOG_THROW
(
spdlog_ex
(
"Failed removing daily file "
+
filename_to_str
(
old_filename
),
errno
)
);
throw_spdlog_ex
(
"Failed removing daily file "
+
filename_to_str
(
old_filename
),
errno
);
}
}
filenames_q_
.
push_back
(
std
::
move
(
current_file
));
...
...
include/spdlog/sinks/systemd_sink.h
View file @
2400cf16
...
...
@@ -72,7 +72,7 @@ protected:
if
(
err
)
{
SPDLOG_THROW
(
spdlog_ex
(
"Failed writing to systemd"
,
errno
)
);
throw_spdlog_ex
(
"Failed writing to systemd"
,
errno
);
}
}
...
...
include/spdlog/sinks/win_eventlog_sink.h
View file @
2400cf16
...
...
@@ -91,7 +91,7 @@ public:
{
if
(
!::
IsValidSid
(
psid
))
{
SPDLOG_THROW
(
spdlog_ex
(
"sid_t::sid_t(): invalid SID received"
)
);
throw_spdlog_ex
(
"sid_t::sid_t(): invalid SID received"
);
}
auto
const
sid_length
{
::
GetLengthSid
(
psid
)};
...
...
include/spdlog/sinks/wincolor_sink-inl.h
View file @
2400cf16
...
...
@@ -158,7 +158,7 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::write_to_file_(const memory_buf_
bool
ok
=
::
WriteFile
(
out_handle_
,
formatted
.
data
()
+
total_written
,
size
-
total_written
,
&
bytes_written
,
nullptr
)
!=
0
;
if
(
!
ok
||
bytes_written
==
0
)
{
SPDLOG_THROW
(
spdlog_ex
(
"wincolor_sink: write_to_file_ failed. GetLastError(): "
+
std
::
to_string
(
::
GetLastError
()
)));
throw_spdlog_ex
(
"wincolor_sink: write_to_file_ failed. GetLastError(): "
+
std
::
to_string
(
::
GetLastError
(
)));
}
total_written
+=
bytes_written
;
}
while
(
total_written
<
size
);
...
...
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