Skip to content

Commit

Permalink
modify: logger config
Browse files Browse the repository at this point in the history
  • Loading branch information
Pure-Peace committed Jun 18, 2021
1 parent 4c6d91c commit 06c4faf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions config/pp-server/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ debug = true
# Level is selected from logger.mode
level = "debug"

# Actix logger middleware format
# Ntex logger middleware format
# Default is: '%a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T'
# https://actix.rs/actix-web/ntex/middleware/struct.Logger.html
actix_log_format = '%s - %{r}a "%r" %b %T'
# If using reverse proxy, use %{X-Forwarded-For}i instead of %a
# https://docs.rs/ntex/0.3.16/ntex/web/middleware/struct.Logger.html
server_log_format = '%s - %a "%r" %b %T'

# Logger will not record logs of these endpoints
# For example,
Expand Down
7 changes: 4 additions & 3 deletions config/pp-server/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ debug = false
# Level is selected from logger.mode
level = "info"

# Actix logger middleware format
# Ntex logger middleware format
# Default is: '%a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T'
# https://actix.rs/actix-web/ntex/middleware/struct.Logger.html
actix_log_format = '%s - %{r}a "%r" %b %T'
# If using reverse proxy, use %{X-Forwarded-For}i instead of %a
# https://docs.rs/ntex/0.3.16/ntex/web/middleware/struct.Logger.html
server_log_format = '%s - %a "%r" %b %T'

# Logger will not record logs of these endpoints
# For example,
Expand Down
2 changes: 1 addition & 1 deletion src/objects/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl PPserver {
// App
App::new()
.wrap(peace_utils::web::make_logger(
&s.logger.actix_log_format,
&s.logger.server_log_format,
s.prom.exclude_endpoint_log,
&s.prom.endpoint,
&s.logger.exclude_endpoints,
Expand Down
2 changes: 1 addition & 1 deletion src/settings/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct LoggerMode {
pub struct Logger {
pub level: String,
pub mode: LoggerMode,
pub actix_log_format: String,
pub server_log_format: String,
pub exclude_endpoints: Vec<String>,
pub exclude_endpoints_regex: Vec<String>,
}
Expand Down

0 comments on commit 06c4faf

Please sign in to comment.