Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
6e0de7b4
Commit
6e0de7b4
authored
13 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
Add log_remove_output and log_deregister_thread
parent
2e42391b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/log.cpp
+17
-0
17 additions, 0 deletions
src/log.cpp
src/log.h
+2
-0
2 additions, 0 deletions
src/log.h
with
19 additions
and
0 deletions
src/log.cpp
+
17
−
0
View file @
6e0de7b4
...
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
...
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include
<map>
#include
<map>
#include
<list>
#include
<list>
#include
<sstream>
#include
<sstream>
#include
<algorithm>
#include
"threads.h"
#include
"threads.h"
#include
"debug.h"
#include
"debug.h"
#include
"gettime.h"
#include
"gettime.h"
...
@@ -46,12 +47,28 @@ void log_add_output_all_levs(ILogOutput *out)
...
@@ -46,12 +47,28 @@ void log_add_output_all_levs(ILogOutput *out)
log_outputs
[
i
].
push_back
(
out
);
log_outputs
[
i
].
push_back
(
out
);
}
}
void
log_remove_output
(
ILogOutput
*
out
)
{
for
(
int
i
=
0
;
i
<
LMT_NUM_VALUES
;
i
++
){
std
::
list
<
ILogOutput
*>::
iterator
it
=
std
::
find
(
log_outputs
[
i
].
begin
(),
log_outputs
[
i
].
end
(),
out
);
if
(
it
!=
log_outputs
[
i
].
end
())
log_outputs
[
i
].
erase
(
it
);
}
}
void
log_register_thread
(
const
std
::
string
&
name
)
void
log_register_thread
(
const
std
::
string
&
name
)
{
{
threadid_t
id
=
get_current_thread_id
();
threadid_t
id
=
get_current_thread_id
();
log_threadnames
[
id
]
=
name
;
log_threadnames
[
id
]
=
name
;
}
}
void
log_deregister_thread
()
{
threadid_t
id
=
get_current_thread_id
();
log_threadnames
.
erase
(
id
);
}
static
std
::
string
get_lev_string
(
enum
LogMessageLevel
lev
)
static
std
::
string
get_lev_string
(
enum
LogMessageLevel
lev
)
{
{
switch
(
lev
){
switch
(
lev
){
...
...
This diff is collapsed.
Click to expand it.
src/log.h
+
2
−
0
View file @
6e0de7b4
...
@@ -48,8 +48,10 @@ class ILogOutput
...
@@ -48,8 +48,10 @@ class ILogOutput
void
log_add_output
(
ILogOutput
*
out
,
enum
LogMessageLevel
lev
);
void
log_add_output
(
ILogOutput
*
out
,
enum
LogMessageLevel
lev
);
void
log_add_output_maxlev
(
ILogOutput
*
out
,
enum
LogMessageLevel
lev
);
void
log_add_output_maxlev
(
ILogOutput
*
out
,
enum
LogMessageLevel
lev
);
void
log_add_output_all_levs
(
ILogOutput
*
out
);
void
log_add_output_all_levs
(
ILogOutput
*
out
);
void
log_remove_output
(
ILogOutput
*
out
);
void
log_register_thread
(
const
std
::
string
&
name
);
void
log_register_thread
(
const
std
::
string
&
name
);
void
log_deregister_thread
();
void
log_printline
(
enum
LogMessageLevel
lev
,
const
std
::
string
&
text
);
void
log_printline
(
enum
LogMessageLevel
lev
,
const
std
::
string
&
text
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment