|
10 | 10 |
|
11 | 11 | import six |
12 | 12 |
|
13 | | -from saml2 import root_logger, BINDING_URI, SAMLError |
14 | | -from saml2 import BINDING_SOAP |
15 | | -from saml2 import BINDING_HTTP_REDIRECT |
16 | | -from saml2 import BINDING_HTTP_POST |
17 | 13 | from saml2 import BINDING_HTTP_ARTIFACT |
| 14 | +from saml2 import BINDING_HTTP_POST |
| 15 | +from saml2 import BINDING_HTTP_REDIRECT |
| 16 | +from saml2 import BINDING_SOAP |
| 17 | +from saml2 import BINDING_URI |
| 18 | +from saml2 import SAMLError |
18 | 19 |
|
19 | 20 | from saml2.attribute_converter import ac_factory |
20 | 21 | from saml2.assertion import Policy |
21 | 22 | from saml2.mdstore import MetadataStore |
22 | 23 | from saml2.saml import NAME_FORMAT_URI |
23 | 24 | from saml2.virtual_org import VirtualOrg |
24 | 25 |
|
| 26 | + |
25 | 27 | logger = logging.getLogger(__name__) |
26 | 28 |
|
27 | 29 | __author__ = 'rolandh' |
|
47 | 49 | "contact_person", |
48 | 50 | "name_form", |
49 | 51 | "virtual_organization", |
50 | | - "logger", |
51 | 52 | "only_use_keys_in_metadata", |
52 | 53 | "disable_ssl_certificate_validation", |
53 | 54 | "preferred_binding", |
@@ -211,7 +212,6 @@ def __init__(self, homedir="."): |
211 | 212 | self.name_id_format = None |
212 | 213 | self.name_id_format_allow_create = None |
213 | 214 | self.virtual_organization = None |
214 | | - self.logger = None |
215 | 215 | self.only_use_keys_in_metadata = True |
216 | 216 | self.logout_requests_signed = None |
217 | 217 | self.disable_ssl_certificate_validation = None |
@@ -453,63 +453,6 @@ def endpoint(self, service, binding=None, context=None): |
453 | 453 | else: |
454 | 454 | return unspec |
455 | 455 |
|
456 | | - def log_handler(self): |
457 | | - try: |
458 | | - _logconf = self.logger |
459 | | - except KeyError: |
460 | | - return None |
461 | | - |
462 | | - handler = None |
463 | | - for htyp in LOG_HANDLER: |
464 | | - if htyp in _logconf: |
465 | | - if htyp == "syslog": |
466 | | - args = _logconf[htyp] |
467 | | - if "socktype" in args: |
468 | | - import socket |
469 | | - if args["socktype"] == "dgram": |
470 | | - args["socktype"] = socket.SOCK_DGRAM |
471 | | - elif args["socktype"] == "stream": |
472 | | - args["socktype"] = socket.SOCK_STREAM |
473 | | - else: |
474 | | - raise ConfigurationError("Unknown socktype!") |
475 | | - try: |
476 | | - handler = LOG_HANDLER[htyp](**args) |
477 | | - except TypeError: # difference between 2.6 and 2.7 |
478 | | - del args["socktype"] |
479 | | - handler = LOG_HANDLER[htyp](**args) |
480 | | - else: |
481 | | - handler = LOG_HANDLER[htyp](**_logconf[htyp]) |
482 | | - break |
483 | | - |
484 | | - if handler is None: |
485 | | - # default if rotating logger |
486 | | - handler = LOG_HANDLER["rotating"]() |
487 | | - |
488 | | - if "format" in _logconf: |
489 | | - formatter = logging.Formatter(_logconf["format"]) |
490 | | - else: |
491 | | - formatter = logging.Formatter(LOG_FORMAT) |
492 | | - |
493 | | - handler.setFormatter(formatter) |
494 | | - return handler |
495 | | - |
496 | | - def setup_logger(self): |
497 | | - if root_logger.level != logging.NOTSET: # Someone got there before me |
498 | | - return root_logger |
499 | | - |
500 | | - _logconf = self.logger |
501 | | - if _logconf is None: |
502 | | - return root_logger |
503 | | - |
504 | | - try: |
505 | | - root_logger.setLevel(LOG_LEVEL[_logconf["loglevel"].lower()]) |
506 | | - except KeyError: # reasonable default |
507 | | - root_logger.setLevel(logging.INFO) |
508 | | - |
509 | | - root_logger.addHandler(self.log_handler()) |
510 | | - root_logger.info("Logging started") |
511 | | - return root_logger |
512 | | - |
513 | 456 | def endpoint2service(self, endpoint, context=None): |
514 | 457 | endps = self.getattr("endpoints", context) |
515 | 458 |
|
|
0 commit comments