Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ca436714

Přidáno uživatelem David Friesecký před téměř 4 roky(ů)

Re #8570 - Logger configuration
- implemented dictionary to string in utils
- implemented log functions with parameter message only (name of file, name of class and name of function
are getting automaticaly)

Zobrazit rozdíly:

app.py
9 9
from src.controllers.certificates_controller import CertController
10 10
from src.controllers.crl_ocsp_controller import CrlOcspController
11 11
from src.services.cryptography import CryptographyService, CryptographyException
12
from src.utils.logger import Logger
12 13

  
13 14
app = Flask(__name__)
14 15

  
......
92 93
    :return: boolean flag indicating whether initialization was successful or not
93 94
    """
94 95

  
96
    configuration.configure_logging()
97

  
95 98
    modules = [configuration.configure_env_variable, ConnectionProvider]
96 99
    injector = Injector(modules)
97 100
    FlaskInjector(app=application, modules=modules)
98 101

  
99
    configuration.configure_logging()
100

  
101 102
    # There's a little dependency on the CryptoService, which is not a pretty thing from
102 103
    # architectural point of view. However it is only a minimal piece of code and
103 104
    # it makes sense to do it in this way instead of trying to run openssl via subprocess here
......
105 106
    try:
106 107
        # if version string is returned, OpenSSL is present on the system
107 108
        print(f"Using {cryptography_service.get_openssl_version()}")
109
        Logger.info(f"Using {cryptography_service.get_openssl_version()}")
108 110
        # TODO log the version instead of prining it out
109 111
        return True
110 112
    except CryptographyException:
111 113
        # If getting the version string throws an exception the OpenSSL is not available
112 114
        print("OpenSSL was not located on the system. Application will now exit.")
115
        Logger.error(f"OpenSSL was not located on the system. Application will now exit.")
113 116
        # TODO add logging here
114 117
        return False
115 118

  
......
119 122
    if not initialize_app(app):
120 123
        # TODO log this
121 124
        print("Failed to initialize app, aborting...")
125
        Logger.error(f"Failed to initialize app, aborting...")
122 126
        exit(-1)
123 127

  
124 128
if __name__ == '__main__':

Také k dispozici: Unified diff