Commit 25adff51 authored by Guillaume Seguin's avatar Guillaume Seguin

Setup a logging handler to log to stdout

parent e47bc618
......@@ -25,6 +25,9 @@ import time
import sys
import platform
import os
import sys
reload(sys).setdefaultencoding('utf8')
import logging
import traceback
import errno
import socket
......@@ -32,9 +35,11 @@ import re
from functools import wraps
from collections import deque
from printrun.GCodeAnalyzer import GCodeAnalyzer
from printrun.printrun_utils import install_locale, decode_utf8
from printrun.printrun_utils import install_locale, decode_utf8, setup_logging
install_locale('pronterface')
setup_logging(sys.stdout)
def locked(f):
@wraps(f)
def inner(*args, **kw):
......
......@@ -16,6 +16,7 @@
import os
import sys
import gettext
import logging
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not
......@@ -29,6 +30,13 @@ def install_locale(domain):
else:
gettext.install(domain, './locale', unicode = 1)
def setup_logging(stdout):
logger = logging.getLogger()
logger.handlers.clear()
logging_handler = logging.StreamHandler(stdout)
logging_handler.setFormatter(logging.Formatter("[%(levelname)s] %(message)s"))
logger.addHandler(logging_handler)
def iconfile(filename):
if hasattr(sys, "frozen") and sys.frozen == "windows_exe":
return sys.executable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment