Skip to content

Overload print builtin #377

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 6 commits into from
Aug 27, 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
8 changes: 8 additions & 0 deletions pkg/workloads/cortex/onnx_serve/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import sys
import os
import argparse
import builtins

from flask import Flask, request, jsonify, g
from flask_api import status
Expand All @@ -27,6 +28,13 @@
from cortex.lib.log import get_logger
from cortex.lib.exceptions import CortexException, UserRuntimeException, UserException


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
8 changes: 8 additions & 0 deletions pkg/workloads/cortex/tf_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import os
import argparse
import time
import builtins

import tensorflow as tf
from flask import Flask, request, jsonify, g
Expand All @@ -32,6 +33,13 @@
from cortex.lib.log import get_logger
from cortex.lib.exceptions import CortexException, UserRuntimeException, UserException


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