Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch off logging #2435

Merged
merged 3 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions lib/iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def callback(cube, field, filename):
import contextlib
import glob
import itertools
import logging
import os.path
import threading

Expand Down Expand Up @@ -131,11 +130,6 @@ def callback(cube, field, filename):
'IrisDeprecation']


# When required, log the usage of Iris.
if iris.config.IMPORT_LOGGER:
logging.getLogger(iris.config.IMPORT_LOGGER).info('iris %s' % __version__)


Constraint = iris._constraints.Constraint
AttributeConstraint = iris._constraints.AttributeConstraint

Expand Down
9 changes: 0 additions & 9 deletions lib/iris/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,6 @@ def get_dir_option(section, option, default=None):
PALETTE_PATH = get_dir_option(_RESOURCE_SECTION, 'palette_path',
os.path.join(CONFIG_PATH, 'palette'))


#################
# Logging options
_LOGGING_SECTION = 'Logging'

IMPORT_LOGGER = get_option(_LOGGING_SECTION, 'import_logger')


#################
# Runtime options

class NetCDF(object):
Expand Down
2 changes: 0 additions & 2 deletions lib/iris/etc/site.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ dot_path = /path/to/dot # see iris.fileformats.dot
sample_data_dir = /path/to/iris/resources/sample_data
test_data_dir = /path/to/iris/resources/test_data

[Logging]
import_logger = logger_name
7 changes: 7 additions & 0 deletions lib/iris/fileformats/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
import six

import collections
from contextlib import contextmanager
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? I'm confused by these ones...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too. I think that must be conflict confusion. I'll just take that bit out.

import getpass
import os
import os.path
import platform
import sys
import types
import warnings

import cf_units
Expand Down
8 changes: 0 additions & 8 deletions lib/iris/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import inspect
import json
import io
import logging
import math
import os
import os.path
Expand Down Expand Up @@ -146,9 +145,6 @@
os.environ['IRIS_TEST_CREATE_MISSING'] = 'true'


# A shared logger for use by unit tests
logger = logging.getLogger('tests')

# Whether to display matplotlib output to the screen.
_DISPLAY_FIGURES = False

Expand Down Expand Up @@ -430,7 +426,6 @@ def assertDataAlmostEqual(self, data, reference_filename, **kwargs):
self.assertArrayAllClose(nstats, data_stats, **kwargs)
else:
self._ensure_folder(reference_path)
logger.warning('Creating result file: %s', reference_path)
stats = collections.OrderedDict([
('std', np.float_(data.std())),
('min', np.float_(data.min())),
Expand All @@ -449,7 +444,6 @@ def assertFilesEqual(self, test_filename, reference_filename):
fmt.format(test_filename, reference_path))
else:
self._ensure_folder(reference_path)
logger.warning('Creating result file: %s', reference_path)
shutil.copy(test_filename, reference_path)

def assertString(self, string, reference_filename=None):
Expand Down Expand Up @@ -492,7 +486,6 @@ def _check_same(self, item, reference_path, type_comparison_name='CML'):
type_comparison_name)
else:
self._ensure_folder(reference_path)
logger.warning('Creating result file: %s', reference_path)
with open(reference_path, 'wb') as reference_fh:
reference_fh.writelines(
part.encode('utf-8')
Expand Down Expand Up @@ -694,7 +687,6 @@ def _check_reference_file(self, reference_path):
def _ensure_folder(self, path):
dir_path = os.path.dirname(path)
if not os.path.exists(dir_path):
logger.warning('Creating folder: %s', dir_path)
os.makedirs(dir_path)

def check_graphic(self):
Expand Down
1 change: 0 additions & 1 deletion lib/iris/tests/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def cube_save_test(self, reference_txt_path, reference_cubes=None, reference_pp_
"""
# Watch out for a missing reference text file
if not os.path.isfile(reference_txt_path):
tests.logger.warning('Creating result file: %s', reference_txt_path)
if reference_cubes:
temp_pp_path = iris.util.create_temp_filename(".pp")
try:
Expand Down
1 change: 0 additions & 1 deletion lib/iris/tests/test_cdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def check_dot(self, cube, reference_filename):
reference = ''.join(reference_fh.readlines())
self._assert_str_same(reference, test_string, reference_filename, type_comparison_name='DOT files')
else:
tests.logger.warning('Creating result file: %s', reference_path)
with open(reference_path, 'w') as reference_fh:
reference_fh.writelines(test_string)

Expand Down
2 changes: 0 additions & 2 deletions lib/iris/tests/test_coord_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import iris.tests as tests

from xml.dom.minidom import Document
import logging

import cf_units
import numpy as np
Expand All @@ -37,7 +36,6 @@
import iris.tests.stock


logger = logging.getLogger('tests')


@tests.skip_data
Expand Down
4 changes: 1 addition & 3 deletions lib/iris/tests/test_coordsystem.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2010 - 2016, Met Office
# (C) British Crown Copyright 2010 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -22,7 +22,6 @@
# import iris tests first so that some things can be initialised before importing anything else
import iris.tests as tests

import logging

import cartopy.crs as ccrs
import cf_units
Expand All @@ -34,7 +33,6 @@
from iris.coord_systems import *


logger = logging.getLogger('tests')


def osgb():
Expand Down
1 change: 0 additions & 1 deletion lib/iris/tests/test_image_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import codecs
import itertools
import json
import logging
import os
import requests
import unittest
Expand Down
1 change: 0 additions & 1 deletion lib/iris/tests/test_pp_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def check_pp(self, pp_fields, reference_filename):
reference = ''.join(reference_fh.readlines())
self._assert_str_same(reference+'\n', test_string+'\n', reference_filename, type_comparison_name='PP files')
else:
tests.logger.warning('Creating result file: %s', reference_path)
with open(reference_path, 'w') as reference_fh:
reference_fh.writelines(test_string)

Expand Down