Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
eta
arti
Commits
4d52f990
Commit
4d52f990
authored
Sep 09, 2021
by
janimo
Browse files
Create a separate logging section in config.
parent
e69d2d45
Changes
3
Hide whitespace changes
Inline
Side-by-side
CONTRIBUTING.md
View file @
4d52f990
...
...
@@ -101,7 +101,7 @@ To do so, we will launch arti independently from Tor Browser. Build arti with
`cargo build --release`
. After that launch it with some basic
configuration parameters:
$ ./target/release/arti -c "socks_port = 9150" -c "trace_filter = 'debug'"
$ ./target/release/arti -c "socks_port = 9150" -c "
logging.
trace_filter = 'debug'"
This will ensure that arti sets its SOCKS port on 9150. Now we need to launch
Tor Browser and instruct it to use that SOCKS port.
...
...
crates/arti/src/arti_defaults.toml
View file @
4d52f990
...
...
@@ -6,8 +6,10 @@
# Note that only one process can listen on a given port at a time.
socks_port
=
9150
# Enable logging to journald where available
# Configure logging
[logging]
# Enable logging to journald where available
journald
=
false
# Specify filtering directives for tracing.
...
...
crates/arti/src/main.rs
View file @
4d52f990
...
...
@@ -126,6 +126,20 @@ const ARTI_DEFAULTS: &str = concat!(
include_str!
(
"./authorities.toml"
),
);
/// Structure to hold our logging configuration options
#[derive(Deserialize,
Debug,
Clone)]
#[serde(deny_unknown_fields)]
struct
LoggingConfig
{
/// Filtering directives that determine tracing levels as described at
/// <https://docs.rs/tracing-subscriber/0.2.20/tracing_subscriber/filter/struct.EnvFilter.html>
///
/// You can override this setting with the environment variable ARTI_LOG.
trace_filter
:
String
,
/// Whether to log to journald
journald
:
bool
,
}
/// Structure to hold our configuration options, whether from a
/// configuration file or the command line.
///
...
...
@@ -138,14 +152,8 @@ pub struct ArtiConfig {
/// connections.
socks_port
:
Option
<
u16
>
,
/// Whether to log to journald
journald
:
bool
,
/// Filtering directives that determine tracing levels as described at
/// <https://docs.rs/tracing-subscriber/0.2.20/tracing_subscriber/filter/struct.EnvFilter.html>
///
/// You can override this setting with the environment variable ARTI_LOG.
trace_filter
:
String
,
/// Logging configuration
logging
:
LoggingConfig
,
/// Information about the Tor network we want to connect to.
network
:
NetworkConfig
,
...
...
@@ -232,13 +240,13 @@ async fn run<R: Runtime>(
fn
setup_logging
(
config
:
&
ArtiConfig
)
{
let
env_filter
=
match
EnvFilter
::
try_from_env
(
"ARTI_LOG"
)
{
Ok
(
f
)
=>
f
,
Err
(
_e
)
=>
EnvFilter
::
new
(
config
.trace_filter
.as_str
()),
Err
(
_e
)
=>
EnvFilter
::
new
(
config
.
logging.
trace_filter
.as_str
()),
};
let
registry
=
registry
()
.with
(
fmt
::
Layer
::
default
())
.with
(
env_filter
);
#[cfg(feature
=
"journald"
)]
if
config
.journald
{
if
config
.
logging.
journald
{
if
let
Ok
(
journald
)
=
tracing_journald
::
layer
()
{
registry
.with
(
journald
)
.init
();
return
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment