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