Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
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
Container Registry
Model registry
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
The Tor Project
Core
Tor
Commits
a5aa80cc
Commit
a5aa80cc
authored
21 years ago
by
Roger Dingledine
Browse files
Options
Downloads
Patches
Plain Diff
make --debuglogfile (or any second log file) work
svn:r935
parent
a0f16c61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/common/log.c
+5
-14
5 additions, 14 deletions
src/common/log.c
src/common/log.h
+0
-2
0 additions, 2 deletions
src/common/log.h
src/or/main.c
+0
-1
0 additions, 1 deletion
src/or/main.c
src/or/test.c
+0
-2
0 additions, 2 deletions
src/or/test.c
with
5 additions
and
19 deletions
src/common/log.c
+
5
−
14
View file @
a5aa80cc
...
...
@@ -24,25 +24,24 @@ static INLINE const char *sev_to_string(int severity) {
}
}
static
int
loglevel
=
LOG_DEBUG
;
static
logfile_t
*
logfiles
=
NULL
;
/* Format a log message into a fixed-sized buffer. (This is factored out
* of 'logv' so that we never format a message more than once.
*/
static
INLINE
void
format_msg
(
char
*
buf
,
size_t
buf_len
,
int
severity
,
const
char
*
funcname
,
const
char
*
format
,
va_list
ap
)
int
severity
,
const
char
*
funcname
,
const
char
*
format
,
va_list
ap
)
{
time_t
t
;
struct
timeval
now
;
int
n
;
buf_len
-=
2
;
/* subtract 2 characters so we have room for \n\0 */
tor_gettimeofday
(
&
now
);
t
=
(
time_t
)
now
.
tv_sec
;
n
=
strftime
(
buf
,
buf_len
,
"%b %d %H:%M:%S"
,
localtime
(
&
t
));
n
+=
snprintf
(
buf
+
n
,
buf_len
-
n
,
".%.3ld [%s] "
,
...
...
@@ -71,10 +70,8 @@ logv(int severity, const char *funcname, const char *format, va_list ap)
char
buf
[
10024
];
int
formatted
=
0
;
logfile_t
*
lf
;
assert
(
format
);
if
(
severity
<
loglevel
)
return
;
for
(
lf
=
logfiles
;
lf
;
lf
=
lf
->
next
)
{
if
(
severity
<
lf
->
loglevel
||
severity
>
lf
->
max_loglevel
)
continue
;
...
...
@@ -91,12 +88,6 @@ logv(int severity, const char *funcname, const char *format, va_list ap)
}
}
void
log_set_severity
(
int
severity
)
{
loglevel
=
severity
;
}
/* Outputs a message to stdout */
void
_log
(
int
severity
,
const
char
*
format
,
...)
{
...
...
This diff is collapsed.
Click to expand it.
src/common/log.h
+
0
−
2
View file @
a5aa80cc
...
...
@@ -22,8 +22,6 @@
#define CHECK_PRINTF(formatIdx, firstArg)
#endif
void
log_set_severity
(
int
severity
);
void
add_stream_log
(
int
loglevel
,
const
char
*
name
,
FILE
*
stream
);
int
add_file_log
(
int
severity
,
const
char
*
filename
);
void
close_logs
();
...
...
This diff is collapsed.
Click to expand it.
src/or/main.c
+
0
−
1
View file @
a5aa80cc
...
...
@@ -400,7 +400,6 @@ static int init_from_config(int argc, char **argv) {
log_fn
(
LOG_ERR
,
"Reading config failed. For usage, try -h."
);
return
-
1
;
}
log_set_severity
(
options
.
loglevel
);
/* assign logging severity level from options */
close_logs
();
/* we'll close, then open with correct loglevel if necessary */
if
(
!
options
.
LogFile
&&
!
options
.
RunAsDaemon
)
add_stream_log
(
options
.
loglevel
,
"<stdout>"
,
stdout
);
...
...
This diff is collapsed.
Click to expand it.
src/or/test.c
+
0
−
2
View file @
a5aa80cc
...
...
@@ -589,7 +589,6 @@ test_dir_format()
&
pk3_str_len
));
memset
(
buf
,
0
,
2048
);
log_set_severity
(
LOG_WARN
);
test_assert
(
router_dump_router_to_string
(
buf
,
2048
,
&
r1
,
pk2
)
>
0
);
strcpy
(
buf2
,
"router Magri testaddr1.foo.bar 9000 9002 9003 1000
\n
"
...
...
@@ -698,7 +697,6 @@ main(int c, char**v){
if(getconfig(c,v,&options))
exit(1);
#endif
log_set_severity
(
LOG_ERR
);
/* make logging quieter */
crypto_seed_rng
();
...
...
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