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
163de5a7
Commit
163de5a7
authored
Jan 04, 2013
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also log early notifications before SIPApplicationWillStart
parent
6820a1e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
__init__.py
blink/__init__.py
+2
-2
logging.py
blink/logging.py
+18
-1
No files found.
blink/__init__.py
View file @
163de5a7
...
@@ -93,6 +93,7 @@ class Blink(QApplication):
...
@@ -93,6 +93,7 @@ class Blink(QApplication):
self
.
first_run
=
False
self
.
first_run
=
False
self
.
main_window
=
MainWindow
()
self
.
main_window
=
MainWindow
()
self
.
ip_address_monitor
=
IPAddressMonitor
()
self
.
ip_address_monitor
=
IPAddressMonitor
()
self
.
log_manager
=
LogManager
()
self
.
update_manager
=
UpdateManager
()
self
.
update_manager
=
UpdateManager
()
self
.
main_window
.
check_for_updates_action
.
triggered
.
connect
(
self
.
update_manager
.
check_for_updates
)
self
.
main_window
.
check_for_updates_action
.
triggered
.
connect
(
self
.
update_manager
.
check_for_updates
)
...
@@ -205,8 +206,7 @@ class Blink(QApplication):
...
@@ -205,8 +206,7 @@ class Blink(QApplication):
handler
(
notification
)
handler
(
notification
)
def
_NH_SIPApplicationWillStart
(
self
,
notification
):
def
_NH_SIPApplicationWillStart
(
self
,
notification
):
log_manager
=
LogManager
()
self
.
log_manager
.
start
()
log_manager
.
start
()
@
run_in_gui_thread
@
run_in_gui_thread
def
_NH_SIPApplicationDidStart
(
self
,
notification
):
def
_NH_SIPApplicationDidStart
(
self
,
notification
):
...
...
blink/logging.py
View file @
163de5a7
...
@@ -7,11 +7,12 @@ __all__ = ['LogManager']
...
@@ -7,11 +7,12 @@ __all__ = ['LogManager']
import
os
import
os
import
sys
import
sys
from
collections
import
deque
from
datetime
import
datetime
from
datetime
import
datetime
from
pprint
import
pformat
from
pprint
import
pformat
from
application
import
log
from
application
import
log
from
application.notification
import
IObserver
,
NotificationCenter
from
application.notification
import
IObserver
,
NotificationCenter
,
ObserverWeakrefProxy
from
application.python.queue
import
EventQueue
from
application.python.queue
import
EventQueue
from
application.python
import
Null
from
application.python
import
Null
from
application.python.types
import
Singleton
from
application.python.types
import
Singleton
...
@@ -23,6 +24,17 @@ from sipsimple.configuration.settings import SIPSimpleSettings
...
@@ -23,6 +24,17 @@ from sipsimple.configuration.settings import SIPSimpleSettings
from
blink.resources
import
ApplicationData
from
blink.resources
import
ApplicationData
class
NotificationQueue
(
object
):
implements
(
IObserver
)
def
__init__
(
self
):
self
.
notifications
=
deque
()
NotificationCenter
()
.
add_observer
(
ObserverWeakrefProxy
(
self
))
def
handle_notification
(
self
,
notification
):
self
.
notifications
.
append
(
notification
)
class
LogFile
(
object
):
class
LogFile
(
object
):
def
__init__
(
self
,
filename
):
def
__init__
(
self
,
filename
):
self
.
filename
=
filename
self
.
filename
=
filename
...
@@ -74,6 +86,7 @@ class LogManager(object):
...
@@ -74,6 +86,7 @@ class LogManager(object):
self
.
pjsiptrace_file
=
Null
self
.
pjsiptrace_file
=
Null
self
.
notifications_file
=
Null
self
.
notifications_file
=
Null
self
.
event_queue
=
Null
self
.
event_queue
=
Null
self
.
notification_queue
=
NotificationQueue
()
self
.
_siptrace_start_time
=
None
self
.
_siptrace_start_time
=
None
self
.
_siptrace_packet_count
=
None
self
.
_siptrace_packet_count
=
None
...
@@ -93,6 +106,10 @@ class LogManager(object):
...
@@ -93,6 +106,10 @@ class LogManager(object):
self
.
_siptrace_packet_count
=
0
self
.
_siptrace_packet_count
=
0
self
.
event_queue
=
EventQueue
(
handler
=
self
.
_process_notification
,
name
=
'Log handling'
)
self
.
event_queue
=
EventQueue
(
handler
=
self
.
_process_notification
,
name
=
'Log handling'
)
self
.
event_queue
.
start
()
self
.
event_queue
.
start
()
while
settings
.
logs
.
trace_notifications
and
self
.
notification_queue
.
notifications
:
notification
=
self
.
notification_queue
.
notifications
.
popleft
()
self
.
handle_notification
(
notification
)
self
.
notification_queue
=
None
def
stop
(
self
):
def
stop
(
self
):
notification_center
=
NotificationCenter
()
notification_center
=
NotificationCenter
()
...
...
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