feat(ssh-wrapeprs): moved the setup logging into common function to not relly on v1 codebase
This commit is contained in:
parent
0b73535140
commit
2f216c3acf
3 changed files with 36 additions and 18 deletions
|
|
@ -23,28 +23,14 @@ import logging
|
|||
|
||||
import click
|
||||
|
||||
from pyramid.paster import setup_logging
|
||||
|
||||
from rhodecode.lib.pyramid_utils import bootstrap
|
||||
from rhodecode.lib.statsd_client import StatsdClient
|
||||
from .backends import SshWrapper
|
||||
from .utils import setup_custom_logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup_custom_logging(ini_path, debug):
|
||||
if debug:
|
||||
# enabled rhodecode.ini controlled logging setup
|
||||
setup_logging(ini_path)
|
||||
else:
|
||||
# configure logging in a mode that doesn't print anything.
|
||||
# in case of regularly configured logging it gets printed out back
|
||||
# to the client doing an SSH command.
|
||||
logger = logging.getLogger('')
|
||||
null = logging.NullHandler()
|
||||
# add the handler to the root logger
|
||||
logger.handlers = [null]
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument('ini_path', type=click.Path(exists=True))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue