Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
钟尚武
dlib
Commits
10d265db
Commit
10d265db
authored
Feb 14, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added an overload of configure_loggers_from_file() that can read directly from
a config_reader.
parent
89f3e775
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
logger_config_file.cpp
dlib/logger/logger_config_file.cpp
+13
-9
logger_config_file.h
dlib/logger/logger_config_file.h
+13
-0
No files found.
dlib/logger/logger_config_file.cpp
View file @
10d265db
...
...
@@ -19,7 +19,6 @@ namespace dlib
namespace
logger_config_file_helpers
{
typedef
config_reader
::
kernel_1a
cr_type
;
// ----------------------------------------------------------------------------------------
...
...
@@ -84,7 +83,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
void
configure_sub_blocks
(
const
c
r_type
&
cr
,
const
c
onfig_reader
&
cr
,
const
std
::
string
&
name
)
{
...
...
@@ -138,24 +137,29 @@ namespace dlib
// ----------------------------------------------------------------------------------------
void
configure_loggers_from_file
(
const
std
::
string
&
file_name
const
std
::
string
&
file_name
)
{
using
namespace
logger_config_file_helpers
;
using
namespace
std
;
ifstream
fin
(
file_name
.
c_str
());
std
::
ifstream
fin
(
file_name
.
c_str
());
if
(
!
fin
)
throw
logger_config_file_error
(
"logger_config: unable to open config file "
+
file_name
);
configure_loggers_from_file
(
config_reader
(
fin
));
}
cr_type
main_cr
;
main_cr
.
load_from
(
fin
);
// ----------------------------------------------------------------------------------------
void
configure_loggers_from_file
(
const
config_reader
&
main_cr
)
{
using
namespace
logger_config_file_helpers
;
using
namespace
std
;
if
(
main_cr
.
is_block_defined
(
"logger_config"
))
{
const
c
r_type
&
cr
=
main_cr
.
block
(
"logger_config"
);
const
c
onfig_reader
&
cr
=
main_cr
.
block
(
"logger_config"
);
if
(
cr
.
is_key_defined
(
"logging_level"
))
{
...
...
dlib/logger/logger_config_file.h
View file @
10d265db
...
...
@@ -34,6 +34,19 @@ namespace dlib
this exception is thrown if there is a problem reading the config file
!*/
void
configure_loggers_from_file
(
const
config_reader
&
cr
);
/*!
ensures
- configures the loggers with the contents of cr. This function is just like
the above version that reads from a file except that it reads from an in-memory
config_reader instead.
throws
- dlib::logger_config_file_error
this exception is thrown if there is a problem reading the config file
!*/
// ----------------------------------------------------------------------------------------
/*!
...
...
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