Skip to content

Remove builtin override and allow prints #406

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

Merged
merged 3 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 5 additions & 7 deletions pkg/workloads/cortex/lib/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,23 @@
# limitations under the License.

import logging
import sys

from cortex.lib import stringify
import datetime as dt


class MyFormatter(logging.Formatter):
converter = dt.datetime.fromtimestamp

def formatTime(self, record, datefmt=None):
def formatTime(self, record, datefmt):
ct = self.converter(record.created)
if datefmt:
s = ct.strftime(datefmt)
else:
t = ct.strftime("%Y-%m-%d %H:%M:%S")
s = "%s,%03d" % (t, record.msecs)
s = ct.strftime(datefmt)
return s


logger = logging.getLogger("cortex")
handler = logging.StreamHandler()
handler = logging.StreamHandler(stream=sys.stdout)
formatter = MyFormatter(
fmt="%(asctime)s:%(name)s:%(levelname)s:%(message)s", datefmt="%Y-%m-%d,%H:%M:%S.%f"
)
Expand Down
7 changes: 0 additions & 7 deletions pkg/workloads/cortex/onnx_serve/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
from cortex.lib.exceptions import CortexException, UserRuntimeException, UserException
from cortex.lib.stringify import truncate


def cortex_print(*args, **kwargs):
logger.info(*args)


builtins.print = cortex_print

logger = get_logger()
logger.propagate = False # prevent double logging (flask modifies root logger)

Expand Down
7 changes: 0 additions & 7 deletions pkg/workloads/cortex/tf_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@
from cortex.lib.exceptions import UserRuntimeException, UserException
from cortex.lib.stringify import truncate


def cortex_print(*args, **kwargs):
logger.info(*args)


builtins.print = cortex_print

logger = get_logger()
logger.propagate = False # prevent double logging (flask modifies root logger)

Expand Down