Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Hacksaar
Haxotel
Commits
5269f460
Commit
5269f460
authored
Aug 01, 2014
by
Ralf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time in log
parent
9cc99edf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
game.py
game.py
+3
-3
util.py
util.py
+10
-3
No files found.
game.py
View file @
5269f460
...
...
@@ -60,15 +60,15 @@ class Game:
def
logDebug
(
self
,
*
args
):
if
self
.
logFile
is
not
None
:
log_file
(
self
.
logFile
,
*
args
)
log_file
(
self
.
logFile
,
*
args
,
clock
=
True
)
def
logInfo
(
self
,
*
args
):
log_file
(
sys
.
stdout
,
*
args
)
if
self
.
logFile
is
not
None
:
log_file
(
self
.
logFile
,
*
args
)
log_file
(
self
.
logFile
,
*
args
,
clock
=
True
)
def
logError
(
self
,
*
args
):
log_file
(
sys
.
stderr
,
*
args
)
if
self
.
logFile
is
not
None
:
log_file
(
self
.
logFile
,
*
args
)
log_file
(
self
.
logFile
,
*
args
,
clock
=
True
)
def
showAdmins
(
self
):
if
not
self
.
admins
:
return
...
...
util.py
View file @
5269f460
import
threading
,
traceback
,
sys
from
datetime
import
datetime
# run a Python command asynchronously
def
fire_and_forget
(
f
):
...
...
@@ -11,7 +12,13 @@ def fire_and_forget(f):
t
.
start
()
def
send_async
(
conn
,
data
):
fire_and_forget
(
lambda
:
conn
.
send
(
data
))
def
do_send
():
try
:
conn
.
send
(
data
)
except
OSError
:
pass
fire_and_forget
(
do_send
)
def
log_file
(
file
,
*
args
):
print
(
*
args
,
file
=
file
,
flush
=
True
)
\ No newline at end of file
def
log_file
(
file
,
*
args
,
clock
=
False
):
prefix
=
datetime
.
now
().
strftime
(
"%Y-%m-%d %H:%M:%S: "
)
if
clock
else
""
print
(
prefix
,
*
args
,
file
=
file
,
flush
=
True
)
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