Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nss-pam-webapi
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
Package Registry
Model registry
Operate
Terraform modules
Monitor
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
magicfelix
nss-pam-webapi
Commits
b262c52e
Verified
Commit
b262c52e
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[Logging] Log correct PID in syslog
parent
f054151e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/logging.rs
+7
-4
7 additions, 4 deletions
src/logging.rs
with
7 additions
and
4 deletions
src/logging.rs
+
7
−
4
View file @
b262c52e
/* Copyright 2021 Nicolas Goy
/* Copyright 2020 Nicolas Goy
* Copyright 2021 Dominik George <nik@naturalnet.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -13,6 +14,9 @@
* limitations under the License.
*/
use
std
::
process
;
use
std
::
convert
::
TryInto
;
use
log
::{
LevelFilter
};
use
syslog
::{
BasicLogger
,
Facility
,
Formatter3164
};
...
...
@@ -21,10 +25,9 @@ pub fn setup_log(log_level: LevelFilter) {
facility
:
Facility
::
LOG_AUTHPRIV
,
hostname
:
None
,
process
:
"nss_pam_oidc"
.into
(),
pid
:
0
,
pid
:
process
::
id
()
.try_into
()
.unwrap_or_default
()
,
};
let
logger
=
syslog
::
unix
(
formatter
)
.expect
(
"could not connect to syslog"
);
log
::
set_boxed_logger
(
Box
::
new
(
BasicLogger
::
new
(
logger
)))
.map
(|()|
log
::
set_max_level
(
LevelFilter
::
Debug
));
log
::
set_boxed_logger
(
Box
::
new
(
BasicLogger
::
new
(
logger
)))
.ok
();
log
::
set_max_level
(
log_level
);
}
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