Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
jlib
Commits
e970a396
Commit
e970a396
authored
May 24, 2017
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ece8f1a6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
Log.h
Log.h
+7
-0
log2.h
log2.h
+8
-1
No files found.
Log.h
View file @
e970a396
...
...
@@ -28,12 +28,19 @@
namespace
jlib
{
#define JLOG_ORIGIN
#define JLOG jlib::log::log_utf16
#define JLOGA jlib::log::log_utf8
#define JLOGW jlib::log::log_utf16
#define JLOGB(b, l) jlib::log::dump_hex(b, l)
#define JLOGASC(b, l) jlib::log::dump_ascii(b, l)
#define JLOG_ERRO JLOGA
#define JLOG_INFO JLOGA
#define JLOG_HEX JLOGB
#define JLOG_ASC JLOGASC
#ifdef __GNUG__
inline
int
_vsnwprintf_s
(
wchar_t
*
__restrict__
__s
,
size_t
n
,
size_t
,
const
wchar_t
*
__restrict__
__format
,
__gnuc_va_list
__arg
)
{
return
std
::
vswprintf
(
__s
,
n
,
__format
,
__arg
);
...
...
log2.h
View file @
e970a396
...
...
@@ -3,6 +3,7 @@
#include "spdlog/spdlog.h"
#ifdef WIN32
#include "spdlog/sinks/msvc_sink.h"
#include "win32.h"
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
...
...
@@ -23,7 +24,7 @@ inline void init_logger(const std::string& file_name = "")
sinks
.
push_back
(
std
::
make_shared
<
spdlog
::
sinks
::
stdout_sink_mt
>
());
sinks
.
push_back
(
std
::
make_shared
<
spdlog
::
sinks
::
daily_file_sink_mt
>
(
#ifdef WIN32
utf8
::
a2w
(
file_name
+
".log"
)
utf8
::
mbcs_to_u16
(
file_name
+
".log"
)
#else
file_name
+
".log"
#endif
...
...
@@ -32,7 +33,13 @@ inline void init_logger(const std::string& file_name = "")
combined_logger
->
set_pattern
(
"[%Y-%m-%d %H:%M:%S.%e] [tid %t] [%L] %v"
);
spdlog
::
register_logger
(
combined_logger
);
}
catch
(
const
spdlog
::
spdlog_ex
&
ex
)
{
#ifdef WIN32
char
msg
[
1024
]
=
{
0
};
sprintf_s
(
msg
,
"Log initialization failed: %s
\n
"
,
ex
.
what
());
OutputDebugStringA
(
msg
);
#else
std
::
cerr
<<
"Log initialization failed: "
<<
ex
.
what
()
<<
std
::
endl
;
#endif
}
}
...
...
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