Removed unused logging module

monasca_common.logging seems to be unused
in other monasca projects therefore should
be removed.

Also removed one dependency that was used only
by that module

Change-Id: Ib875d9bae86c9b2b715edbe0226347b3fc9ec8ed
This commit is contained in:
Tomasz Trębski 2017-02-17 06:42:15 +01:00
parent f3ca3b2005
commit dc7c14d2d0
4 changed files with 0 additions and 103 deletions

View File

@ -1,50 +0,0 @@
# (C) Copyright 2015 HP Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
LOG_FORMAT = '%(process)d %(asctime)s %(levelname)s %(name)s %(message)s'
def get_config(conf):
log_config = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
'format': LOG_FORMAT
}
},
'handlers': {
'console': {
'class': "logging.StreamHandler",
'formatter': "default"
},
'file': {
'class': "logging.handlers.RotatingFileHandler",
'filename': conf.logging.file,
'formatter': "default",
'maxBytes': conf.logging.size,
'backupCount': conf.logging.backup
},
},
'loggers': {
'kazoo': {'level': conf.logging.kazoo},
'kafka': {'level': conf.logging.kafka},
'statsd': {'level': conf.logging.statsd},
'iso8601': {'level': conf.logging.iso8601}
},
'root': {
'handlers': ['console'],
'level': conf.logging.level
}
}
return log_config

View File

@ -1,52 +0,0 @@
# (C) Copyright 2015 HP Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import tempfile
import unittest
from oslo_config import cfg
from monasca_common.logging import dict_config
class CommonTests(unittest.TestCase):
def test_logging_config(self):
logging_opts = [
cfg.StrOpt('level', default='INFO'),
cfg.StrOpt('file', default='/var/log/monasca/monasca.log'),
cfg.StrOpt('size', default=10485760),
cfg.StrOpt('backup', default=5),
cfg.StrOpt('kazoo', default="WARN"),
cfg.StrOpt('kafka', default="WARN"),
cfg.StrOpt('iso8601', default="WARN"),
cfg.StrOpt('statsd', default="WARN")]
logging_group = cfg.OptGroup(name='logging', title='logging')
cfg.CONF.register_group(logging_group)
cfg.CONF.register_opts(logging_opts, logging_group)
tempfile_path = tempfile.mkstemp()[1]
try:
outfile = open(tempfile_path, 'w')
outfile.writelines(
['[logging]\n', 'level = DEBUG\n', 'backup = 3\n'])
outfile.close()
cfg.CONF(args=[], project='test',
default_config_files=[tempfile_path])
log_config = dict_config.get_config(cfg.CONF)
finally:
os.remove(tempfile_path)
self.assertEqual(log_config['handlers']['file']['backupCount'], str(3))

View File

@ -1,7 +1,6 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
iso8601>=0.1.11 # MIT
six>=1.9.0 # MIT
kazoo>=2.2 # Apache-2.0
pykafka>=2.5.0 # Apache 2.0 License