##// END OF EJS Templates
feat(ssh-wrapeprs): moved the setup logging into common function to not relly on v1 codebase
super-admin -
r5316:cf4b8591 default
parent child Browse files
Show More
@@ -0,0 +1,34 b''
1 # Copyright (C) 2016-2023 RhodeCode GmbH
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License, version 3
5 # (only), as published by the Free Software Foundation.
6 #
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
11 #
12 # You should have received a copy of the GNU Affero General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 #
15 # This program is dual-licensed. If you wish to learn more about the
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
19 import logging
20 from pyramid.paster import setup_logging
21
22
23 def setup_custom_logging(ini_path, debug):
24 if debug:
25 # enabled rhodecode.ini controlled logging setup
26 setup_logging(ini_path)
27 else:
28 # configure logging in a mode that doesn't print anything.
29 # in case of regularly configured logging it gets printed out back
30 # to the client doing an SSH command.
31 logger = logging.getLogger('')
32 null = logging.NullHandler()
33 # add the handler to the root logger
34 logger.handlers = [null]
@@ -23,28 +23,14 b' import logging'
23
23
24 import click
24 import click
25
25
26 from pyramid.paster import setup_logging
27
28 from rhodecode.lib.pyramid_utils import bootstrap
26 from rhodecode.lib.pyramid_utils import bootstrap
29 from rhodecode.lib.statsd_client import StatsdClient
27 from rhodecode.lib.statsd_client import StatsdClient
30 from .backends import SshWrapper
28 from .backends import SshWrapper
29 from .utils import setup_custom_logging
31
30
32 log = logging.getLogger(__name__)
31 log = logging.getLogger(__name__)
33
32
34
33
35 def setup_custom_logging(ini_path, debug):
36 if debug:
37 # enabled rhodecode.ini controlled logging setup
38 setup_logging(ini_path)
39 else:
40 # configure logging in a mode that doesn't print anything.
41 # in case of regularly configured logging it gets printed out back
42 # to the client doing an SSH command.
43 logger = logging.getLogger('')
44 null = logging.NullHandler()
45 # add the handler to the root logger
46 logger.handlers = [null]
47
48
34
49 @click.command()
35 @click.command()
50 @click.argument('ini_path', type=click.Path(exists=True))
36 @click.argument('ini_path', type=click.Path(exists=True))
@@ -23,11 +23,9 b' import logging'
23
23
24 import click
24 import click
25
25
26 from pyramid.paster import setup_logging
27
28 from rhodecode.lib.statsd_client import StatsdClient
26 from rhodecode.lib.statsd_client import StatsdClient
29 from .backends import SshWrapperStandalone
27 from .backends import SshWrapperStandalone
30 from .ssh_wrapper_v1 import setup_custom_logging
28 from .utils import setup_custom_logging
31
29
32 log = logging.getLogger(__name__)
30 log = logging.getLogger(__name__)
33
31
General Comments 0
You need to be logged in to leave comments. Login now