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
0969118c
Commit
0969118c
authored
Apr 19, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added default_factory alias
parent
ba7c4c05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
example.cpp
example/example.cpp
+4
-4
spdlog.h
include/spdlog/spdlog.h
+9
-8
No files found.
example/example.cpp
View file @
0969118c
...
...
@@ -14,8 +14,8 @@
#include "spdlog/color_logger.h"
#include "spdlog/stdout_logger.h"
#include "spdlog/async.h"
//
#include "spdlog/stdout_logger.h"
//
#include "spdlog/async.h"
#include "spdlog/spdlog.h"
#include <iostream>
...
...
@@ -36,10 +36,10 @@ int main(int, char *[])
{
// Console logger with color
spd
::
init_thread_pool
(
8192
,
3
);
//
spd::init_thread_pool(8192, 3);
auto
console1
=
spdlog
::
stdout_color_mt
(
"console111"
);
auto
console2
=
spdlog
::
stdout_
logger_mt
<
spdlog
::
create_async
>
(
"console2"
);
auto
console2
=
spdlog
::
stdout_
color_mt
<
>
(
"console2"
);
//auto console3 = spdlog::stdout_color_mt<spdlog::create_async>("console3");
for
(
int
i
=
0
;
i
<
10000
;
i
++
)
{
...
...
include/spdlog/spdlog.h
View file @
0969118c
...
...
@@ -40,6 +40,7 @@ struct create_synchronous
}
};
using
default_factory
=
create_synchronous
;
...
...
@@ -162,13 +163,13 @@ inline void drop_all()
// Create and register multi/single threaded basic file logger.
// Basic logger simply writes to given file without any limitations or rotations.
//
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
basic_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
bool
truncate
=
false
)
{
return
Factory
::
template
create
<
sinks
::
simple_file_sink_mt
>
(
logger_name
,
filename
,
truncate
);
}
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
basic_logger_st
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
bool
truncate
=
false
)
{
return
Factory
::
template
create
<
sinks
::
simple_file_sink_st
>
(
logger_name
,
filename
,
truncate
);
...
...
@@ -177,14 +178,14 @@ inline std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, c
//
// Create and register multi/single threaded rotating file logger
//
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
rotating_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
)
{
return
Factory
::
template
create
<
sinks
::
rotating_file_sink_mt
>
(
logger_name
,
filename
,
max_file_size
,
max_files
);
}
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
rotating_logger_st
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
size_t
max_file_size
,
size_t
max_files
)
{
...
...
@@ -194,13 +195,13 @@ inline std::shared_ptr<logger> rotating_logger_st(
//
// Create file logger which creates new file on the given time (default in midnight):
//
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
daily_logger_mt
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
int
hour
=
0
,
int
minute
=
0
)
{
return
Factory
::
template
create
<
sinks
::
daily_file_sink_mt
>
(
logger_name
,
filename
,
hour
,
minute
);
}
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
daily_logger_st
(
const
std
::
string
&
logger_name
,
const
filename_t
&
filename
,
int
hour
=
0
,
int
minute
=
0
)
{
return
Factory
::
template
create
<
sinks
::
daily_file_sink_st
>
(
logger_name
,
filename
,
hour
,
minute
);
...
...
@@ -209,7 +210,7 @@ inline std::shared_ptr<logger> daily_logger_st(const std::string &logger_name, c
#ifdef SPDLOG_ENABLE_SYSLOG
// Create and register a syslog logger
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
syslog_logger
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
ident
=
""
,
int
syslog_option
=
0
,
int
syslog_facilty
=
(
1
<<
3
))
{
...
...
@@ -219,7 +220,7 @@ inline std::shared_ptr<logger> syslog_logger(
#if defined(__ANDROID__)
// Create and register android syslog logger
template
<
typename
Factory
=
create_synchronous
>
template
<
typename
Factory
=
default_factory
>
inline
std
::
shared_ptr
<
logger
>
android_logger
(
const
std
::
string
&
logger_name
,
const
std
::
string
&
tag
=
"spdlog"
)
{
return
return
Factory
::
template
create
<
sinks
::
android_sink
>
(
logger_name
,
tag
);
...
...
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