Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
aec9fcfe
Commit
aec9fcfe
authored
Jul 06, 2010
by
Luci Stanescu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made logging more robust at application exit
parent
2b32fb83
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
__init__.py
blink/__init__.py
+2
-4
log.py
blink/log.py
+16
-6
No files found.
blink/__init__.py
View file @
aec9fcfe
...
...
@@ -58,6 +58,8 @@ class Blink(QApplication):
self
.
update_manager
.
shutdown
()
self
.
application
.
stop
()
self
.
application
.
thread
.
join
()
log_manager
=
LogManager
()
log_manager
.
stop
()
def
customEvent
(
self
,
event
):
handler
=
getattr
(
self
,
'_EH_
%
s'
%
event
.
name
,
Null
)
...
...
@@ -83,10 +85,6 @@ class Blink(QApplication):
self
.
main_window
.
show
()
self
.
update_manager
.
initialize
()
def
_NH_SIPApplicationDidEnd
(
self
,
notification
):
log_manager
=
LogManager
()
log_manager
.
stop
()
def
_initialize_sipsimple
(
self
):
notification_center
=
NotificationCenter
()
notification_center
.
add_observer
(
self
,
sender
=
self
.
application
)
...
...
blink/log.py
View file @
aec9fcfe
...
...
@@ -2,11 +2,14 @@
# This module will be replaced by an improved logging system. -Luci
#
from
__future__
import
with_statement
__all__
=
[
'LogManager'
]
import
os
import
sys
from
datetime
import
datetime
from
threading
import
RLock
from
application
import
log
from
application.notification
import
IObserver
,
NotificationCenter
...
...
@@ -72,6 +75,7 @@ class LogManager(object):
self
.
pjsiptrace_file
=
Null
self
.
notifications_file
=
Null
self
.
event_queue
=
EventQueue
(
handler
=
self
.
_process_notification
,
name
=
'Log handling'
)
self
.
_lock
=
Null
self
.
_siptrace_start_time
=
None
self
.
_siptrace_packet_count
=
None
...
...
@@ -87,24 +91,30 @@ class LogManager(object):
self
.
pjsiptrace_file
=
LogFile
(
os
.
path
.
join
(
ApplicationData
.
directory
,
'logs'
,
'pjsip_trace.txt'
))
if
settings
.
logs
.
trace_notifications
:
self
.
notifications_file
=
LogFile
(
os
.
path
.
join
(
ApplicationData
.
directory
,
'logs'
,
'notifications_trace.txt'
))
self
.
_lock
=
RLock
()
self
.
_siptrace_start_time
=
datetime
.
now
()
self
.
_siptrace_packet_count
=
0
self
.
event_queue
.
start
()
def
stop
(
self
):
self
.
event_queue
.
stop
()
self
.
event_queue
.
join
()
notification_center
=
NotificationCenter
()
notification_center
.
remove_observer
(
self
)
with
self
.
_lock
:
event_queue
=
self
.
event_queue
self
.
event_queue
=
Null
event_queue
.
stop
()
self
.
_lock
=
Null
event_queue
.
join
()
self
.
siptrace_file
=
Null
self
.
msrptrace_file
=
Null
self
.
pjsiptrace_file
=
Null
self
.
notifications_file
=
Null
notification_center
=
NotificationCenter
()
notification_center
.
remove_observer
(
self
)
def
handle_notification
(
self
,
notification
):
self
.
event_queue
.
put
(
notification
)
with
self
.
_lock
:
self
.
event_queue
.
put
(
notification
)
def
_process_notification
(
self
,
notification
):
handler
=
getattr
(
self
,
'_NH_
%
s'
%
notification
.
name
,
Null
)
...
...
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