Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
25adff51
Commit
25adff51
authored
Oct 27, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup a logging handler to log to stdout
parent
e47bc618
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
printcore.py
printrun/printcore.py
+6
-1
printrun_utils.py
printrun/printrun_utils.py
+8
-0
No files found.
printrun/printcore.py
View file @
25adff51
...
@@ -25,6 +25,9 @@ import time
...
@@ -25,6 +25,9 @@ import time
import
sys
import
sys
import
platform
import
platform
import
os
import
os
import
sys
reload
(
sys
)
.
setdefaultencoding
(
'utf8'
)
import
logging
import
traceback
import
traceback
import
errno
import
errno
import
socket
import
socket
...
@@ -32,9 +35,11 @@ import re
...
@@ -32,9 +35,11 @@ import re
from
functools
import
wraps
from
functools
import
wraps
from
collections
import
deque
from
collections
import
deque
from
printrun.GCodeAnalyzer
import
GCodeAnalyzer
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'
)
install_locale
(
'pronterface'
)
setup_logging
(
sys
.
stdout
)
def
locked
(
f
):
def
locked
(
f
):
@
wraps
(
f
)
@
wraps
(
f
)
def
inner
(
*
args
,
**
kw
):
def
inner
(
*
args
,
**
kw
):
...
...
printrun/printrun_utils.py
View file @
25adff51
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
import
os
import
os
import
sys
import
sys
import
gettext
import
gettext
import
logging
# Set up Internationalization using gettext
# Set up Internationalization using gettext
# searching for installed locales on /usr/share; uses relative folder if not
# searching for installed locales on /usr/share; uses relative folder if not
...
@@ -29,6 +30,13 @@ def install_locale(domain):
...
@@ -29,6 +30,13 @@ def install_locale(domain):
else
:
else
:
gettext
.
install
(
domain
,
'./locale'
,
unicode
=
1
)
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
):
def
iconfile
(
filename
):
if
hasattr
(
sys
,
"frozen"
)
and
sys
.
frozen
==
"windows_exe"
:
if
hasattr
(
sys
,
"frozen"
)
and
sys
.
frozen
==
"windows_exe"
:
return
sys
.
executable
return
sys
.
executable
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment