Skip to content

Commit d2cbb5d

Browse files
committed
💚 convert print to log. resolves #112
1 parent b66ccfc commit d2cbb5d

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

changelog.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: pyexcel-io
22
organisation: pyexcel
33
releases:
4+
- changes:
5+
- action: updated
6+
details:
7+
- "`#112`: Log "Empty Row Warning" instead 'print' "
8+
version: 0.6.6
9+
date: 31.1.2022
410
- changes:
511
- action: updated
612
details:

pyexcel-io.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ project: "pyexcel-io"
33
name: pyexcel-io
44
nick_name: io
55
version: 0.6.5
6-
current_version: 0.6.5
7-
release: 0.6.5
8-
copyright_year: 2015-2020
6+
current_version: 0.6.6
7+
release: 0.6.6
8+
copyright_year: 2015-2022
99
moban_command: false
1010
is_on_conda: true
1111
dependencies:

pyexcel_io/database/importers/django.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, importer, adapter, batch_size=None, bulk_save=True):
3131

3232
def write_row(self, array):
3333
if is_empty_array(array):
34-
print(constants.MESSAGE_EMPTY_ARRAY)
34+
log.warning(constants.MESSAGE_EMPTY_ARRAY)
3535
else:
3636
new_array = swap_empty_string_for_none(array)
3737
if self.mapdict:

pyexcel_io/database/importers/sqlalchemy.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
:copyright: (c) 2014-2020 by Onni Software Ltd.
88
:license: New BSD License, see LICENSE for more details
99
"""
10+
import logging
11+
1012
import pyexcel_io.constants as constants
1113
from pyexcel_io.utils import is_empty_array, swap_empty_string_for_none
1214
from pyexcel_io.plugin_api import IWriter, ISheetWriter
1315

16+
LOG = logging.getLogger(__name__)
17+
1418

1519
class PyexcelSQLSkipRowException(Exception):
1620
"""
@@ -35,14 +39,14 @@ def __init__(
3539

3640
def write_row(self, array):
3741
if is_empty_array(array):
38-
print(constants.MESSAGE_EMPTY_ARRAY)
42+
LOG.warning(constants.MESSAGE_EMPTY_ARRAY)
3943
else:
4044
new_array = swap_empty_string_for_none(array)
4145
try:
4246
self._write_row(new_array)
4347
except PyexcelSQLSkipRowException:
44-
print(constants.MESSAGE_IGNORE_ROW)
45-
print(new_array)
48+
LOG.info(constants.MESSAGE_IGNORE_ROW)
49+
LOG.info(new_array)
4650

4751
def _write_row(self, array):
4852
new_array = array

0 commit comments

Comments
 (0)