Passed logging message parameters as arguments instead of interpolating them.
This commit is contained in:
parent
62ca2dea04
commit
e6ca15c13f
|
@ -35,10 +35,7 @@ class OpenLayersWidget(Textarea):
|
|||
try:
|
||||
value = GEOSGeometry(value)
|
||||
except (GEOSException, ValueError) as err:
|
||||
logger.error(
|
||||
"Error creating geometry from value '%s' (%s)" % (
|
||||
value, err)
|
||||
)
|
||||
logger.error("Error creating geometry from value '%s' (%s)", value, err)
|
||||
value = None
|
||||
|
||||
if (value and value.geom_type.upper() != self.geom_type and
|
||||
|
@ -68,8 +65,8 @@ class OpenLayersWidget(Textarea):
|
|||
wkt = ogr.wkt
|
||||
except GDALException as err:
|
||||
logger.error(
|
||||
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
|
||||
value.srid, srid, err)
|
||||
"Error transforming geometry from srid '%s' to srid '%s' (%s)",
|
||||
value.srid, srid, err
|
||||
)
|
||||
wkt = ''
|
||||
else:
|
||||
|
|
|
@ -57,7 +57,7 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor):
|
|||
except OperationalError:
|
||||
logger.error(
|
||||
"Couldn't remove spatial index: %s (may be expected "
|
||||
"if your storage engine doesn't support them)." % sql
|
||||
"if your storage engine doesn't support them).", sql
|
||||
)
|
||||
|
||||
super(MySQLGISSchemaEditor, self).remove_field(model, field)
|
||||
|
@ -72,6 +72,6 @@ class MySQLGISSchemaEditor(DatabaseSchemaEditor):
|
|||
except OperationalError:
|
||||
logger.error(
|
||||
"Cannot create SPATIAL INDEX %s. Only MyISAM and (as of "
|
||||
"MySQL 5.7.5) InnoDB support them." % sql
|
||||
"MySQL 5.7.5) InnoDB support them.", sql
|
||||
)
|
||||
self.geometry_sql = []
|
||||
|
|
|
@ -40,10 +40,7 @@ class BaseGeometryWidget(Widget):
|
|||
try:
|
||||
return GEOSGeometry(value, self.map_srid)
|
||||
except (GEOSException, ValueError) as err:
|
||||
logger.error(
|
||||
"Error creating geometry from value '%s' (%s)" % (
|
||||
value, err)
|
||||
)
|
||||
logger.error("Error creating geometry from value '%s' (%s)", value, err)
|
||||
return None
|
||||
|
||||
def render(self, name, value, attrs=None):
|
||||
|
@ -61,8 +58,8 @@ class BaseGeometryWidget(Widget):
|
|||
value = ogr
|
||||
except gdal.GDALException as err:
|
||||
logger.error(
|
||||
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
|
||||
value.srid, self.map_srid, err)
|
||||
"Error transforming geometry from srid '%s' to srid '%s' (%s)",
|
||||
value.srid, self.map_srid, err
|
||||
)
|
||||
|
||||
context = self.build_attrs(
|
||||
|
|
|
@ -105,7 +105,7 @@ CPLErrorHandler = CFUNCTYPE(None, c_int, c_int, c_char_p)
|
|||
|
||||
|
||||
def err_handler(error_class, error_number, message):
|
||||
logger.error('GDAL_ERROR %d: %s' % (error_number, message))
|
||||
logger.error('GDAL_ERROR %d: %s', error_number, message)
|
||||
err_handler = CPLErrorHandler(err_handler)
|
||||
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ def notice_h(fmt, lst):
|
|||
warn_msg = fmt % lst
|
||||
except TypeError:
|
||||
warn_msg = fmt
|
||||
logger.warning('GEOS_NOTICE: %s\n' % warn_msg)
|
||||
logger.warning('GEOS_NOTICE: %s\n', warn_msg)
|
||||
notice_h = NOTICEFUNC(notice_h)
|
||||
|
||||
ERRORFUNC = CFUNCTYPE(None, c_char_p, c_char_p)
|
||||
|
@ -96,7 +96,7 @@ def error_h(fmt, lst):
|
|||
err_msg = fmt % lst
|
||||
except TypeError:
|
||||
err_msg = fmt
|
||||
logger.error('GEOS_ERROR: %s\n' % err_msg)
|
||||
logger.error('GEOS_ERROR: %s\n', err_msg)
|
||||
error_h = ERRORFUNC(error_h)
|
||||
|
||||
# #### GEOS Geometry C data structures, and utility functions. ####
|
||||
|
|
|
@ -98,7 +98,7 @@ class BaseDatabaseSchemaEditor(object):
|
|||
Executes the given SQL statement, with optional parameters.
|
||||
"""
|
||||
# Log the command we're running, then run it
|
||||
logger.debug("%s; (params %r)" % (sql, params))
|
||||
logger.debug("%s; (params %r)", sql, params)
|
||||
if self.collect_sql:
|
||||
ending = "" if sql.endswith(";") else ";"
|
||||
if params is not None:
|
||||
|
|
|
@ -85,7 +85,7 @@ class CursorDebugWrapper(CursorWrapper):
|
|||
'sql': sql,
|
||||
'time': "%.3f" % duration,
|
||||
})
|
||||
logger.debug('(%.3f) %s; args=%s' % (duration, sql, params),
|
||||
logger.debug('(%.3f) %s; args=%s', duration, sql, params,
|
||||
extra={'duration': duration, 'sql': sql, 'params': params}
|
||||
)
|
||||
|
||||
|
@ -104,7 +104,7 @@ class CursorDebugWrapper(CursorWrapper):
|
|||
'sql': '%s times: %s' % (times, sql),
|
||||
'time': "%.3f" % duration,
|
||||
})
|
||||
logger.debug('(%.3f) %s; args=%s' % (duration, sql, param_list),
|
||||
logger.debug('(%.3f) %s; args=%s', duration, sql, param_list,
|
||||
extra={'duration': duration, 'sql': sql, 'params': param_list}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue