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
a047b58e
Commit
a047b58e
authored
Jun 22, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added "basic_logger_mt/basic_logger_st" to the API
parent
cef7eb06
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
2 deletions
+32
-2
README.md
README.md
+7
-0
example/example.cpp
example/example.cpp
+5
-0
example/example.vcxproj
example/example.vcxproj
+2
-2
include/spdlog/details/spdlog_impl.h
include/spdlog/details/spdlog_impl.h
+11
-0
include/spdlog/spdlog.h
include/spdlog/spdlog.h
+7
-0
No files found.
README.md
View file @
a047b58e
...
...
@@ -89,6 +89,13 @@ int main(int, char* [])
console
->
set_level
(
spd
::
level
::
debug
);
// Set specific logger's log level
console
->
debug
(
"Now it should.."
);
//
// Create a basic file logger (multithreaded, use "file_logger_st" for single threaded logger)
//
auto
simple_logger
=
spd
::
file_logger_mt
(
"basic_logger"
,
"logs/simple.txt"
);
simple_logger
->
info
(
"Some log message"
);
//
// Create a file rotating logger with 5mb size max and 3 rotated files
//
...
...
example/example.cpp
View file @
a047b58e
...
...
@@ -43,6 +43,11 @@ int main(int, char*[])
console
->
set_level
(
spd
::
level
::
debug
);
// Set specific logger's log level
console
->
debug
(
"This message shold be displayed.."
);
// Create basic file logger (not rotated)
auto
simple_logger
=
spd
::
basic_logger_mt
(
"basic_logger"
,
"logs/simple.txt"
);
simple_logger
->
info
(
"Some log message"
);
// Create a file rotating logger with 5mb size max and 3 rotated files
auto
file_logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/mylogfile"
,
1048576
*
5
,
3
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
...
...
example/example.vcxproj
View file @
a047b58e
...
...
@@ -22,13 +22,13 @@
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseDebugLibraries>
true
</UseDebugLibraries>
<PlatformToolset>
v1
4
0
</PlatformToolset>
<PlatformToolset>
v1
2
0
</PlatformToolset>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseDebugLibraries>
false
</UseDebugLibraries>
<PlatformToolset>
v1
4
0
</PlatformToolset>
<PlatformToolset>
v1
2
0
</PlatformToolset>
<WholeProgramOptimization>
true
</WholeProgramOptimization>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
...
...
include/spdlog/details/spdlog_impl.h
View file @
a047b58e
...
...
@@ -35,6 +35,17 @@ inline void spdlog::drop(const std::string &name)
details
::
registry
::
instance
().
drop
(
name
);
}
// Create multi/single threaded simple file logger
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
basic_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
bool
force_flush
)
{
return
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
logger_name
,
filename
,
force_flush
);
}
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
basic_logger_st
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
bool
force_flush
)
{
return
create
<
spdlog
::
sinks
::
simple_file_sink_st
>
(
logger_name
,
filename
,
force_flush
);
}
// Create multi/single threaded rotating file logger
inline
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
,
bool
force_flush
)
{
...
...
include/spdlog/spdlog.h
View file @
a047b58e
...
...
@@ -62,6 +62,13 @@ void set_async_mode(size_t queue_size, const async_overflow_policy overflow_poli
// Turn off async mode
void
set_sync_mode
();
//
// Create and register multi/single basic file logger
//
std
::
shared_ptr
<
logger
>
basic_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
bool
force_flush
=
false
);
std
::
shared_ptr
<
logger
>
basic_logger_st
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
bool
force_flush
=
false
);
//
// Create and register multi/single threaded rotating file logger
//
...
...
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