Skip to content

Commit 9f85123

Browse files
committed
Fixes to the logging params
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent cb638d8 commit 9f85123

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/satosa/micro_services/ldap_attribute_store.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
import ldap3
1515
from ldap3.core.exceptions import LDAPException
1616

17+
import satosa.logging_util as lu
1718
from satosa.exception import SATOSAError
1819
from satosa.micro_services.base import ResponseMicroService
1920
from satosa.response import Redirect
2021

21-
import satosa.logging_util as lu
22+
2223
logger = logging.getLogger(__name__)
2324

2425
KEY_FOUND_LDAP_RECORD = "ldap_attribute_store_found_record"
@@ -372,8 +373,8 @@ def _populate_attributes(self, config, record):
372373
else [values]
373374
)
374375
msg = "Recording internal attribute {} with values {}"
375-
msg = msg.format(internal_attr, attributes[internal_attr])
376-
logger.debug(msg)
376+
logline = msg.format(internal_attr, attributes[internal_attr])
377+
logger.debug(logline)
377378

378379
return attributes
379380

@@ -452,7 +453,8 @@ def process(self, context, data):
452453
"message": "LDAP server host",
453454
"server host": connection.server.host,
454455
}
455-
satosa_logging(logger, logging.DEBUG, msg, context.state)
456+
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
457+
logger.debug(logline)
456458

457459
for filter_val in filter_values:
458460
ldap_ident_attr = config["ldap_identifier_attribute"]
@@ -576,7 +578,7 @@ def process(self, context, data):
576578
else:
577579
msg = "No record found in LDAP so no attributes will be added"
578580
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
579-
logger.warning(msg)
581+
logger.warning(logline)
580582
on_ldap_search_result_empty = config["on_ldap_search_result_empty"]
581583
if on_ldap_search_result_empty:
582584
# Redirect to the configured URL with
@@ -591,10 +593,10 @@ def process(self, context, data):
591593
)
592594
msg = "Redirecting to {}".format(url)
593595
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
594-
logger.info(msg)
596+
logger.info(logline)
595597
return Redirect(url)
596598

597599
msg = "Returning data.attributes {}".format(data.attributes)
598600
logline = lu.LOG_FMT.format(id=lu.get_session_id(context.state), message=msg)
599-
logger.debug(msg)
601+
logger.debug(logline)
600602
return super().process(context, data)

0 commit comments

Comments
 (0)