Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
fcdd5f96
Commit
fcdd5f96
authored
Sep 02, 2015
by
Ian Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose logs for Sky apps running on connected devices with sky_tool logs.
parent
fc6f91c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
1 deletion
+111
-1
sky_tool
packages/flutter/lib/sky_tool
+111
-1
No files found.
packages/flutter/lib/sky_tool
View file @
fcdd5f96
...
...
@@ -9,6 +9,7 @@ import errno
import
hashlib
import
json
import
logging
import
multiprocessing
import
os
import
platform
import
random
...
...
@@ -146,6 +147,46 @@ def _url_for_path(port, root, path):
return
'http://localhost:
%
s/
%
s'
%
(
port
,
relative_path
)
class
SkyLogs
(
object
):
def
add_subparser
(
self
,
subparsers
):
logs_parser
=
subparsers
.
add_parser
(
'logs'
,
help
=
'Show logs for running Sky apps'
)
logs_parser
.
set_defaults
(
func
=
self
.
run
)
def
run
(
self
,
args
,
pids
):
android_log_reader
=
None
ios_dev_log_reader
=
None
ios_sim_log_reader
=
None
android
=
AndroidDevice
()
if
android
.
is_connected
():
android_log_reader
=
android
.
logs
()
if
IOSDevice
.
is_connected
():
ios_dev_log_reader
=
IOSDevice
.
logs
()
if
IOSSimulator
.
is_connected
():
ios_sim_log_reader
=
IOSSimulator
.
logs
()
if
android_log_reader
is
not
None
:
try
:
android_log_reader
.
join
()
except
KeyboardInterrupt
:
pass
if
ios_dev_log_reader
is
not
None
:
try
:
ios_dev_log_reader
.
join
()
except
KeyboardInterrupt
:
pass
if
ios_sim_log_reader
is
not
None
:
try
:
ios_sim_log_reader
.
join
()
except
KeyboardInterrupt
:
pass
class
InstallSky
(
object
):
def
add_subparser
(
self
,
subparsers
):
install_parser
=
subparsers
.
add_parser
(
'install'
,
...
...
@@ -447,6 +488,27 @@ class AndroidDevice(object):
logging
.
info
(
' '
.
join
(
cmd
))
subprocess
.
check_output
(
cmd
)
def
logs
(
self
):
def
do_logs
():
cmd
=
[
self
.
adb_path
,
'logcat'
,
'-s'
,
'sky'
,
'chromium'
,
]
logging
.
info
(
' '
.
join
(
cmd
))
log_process
=
subprocess
.
Popen
(
cmd
,
bufsize
=
1
,
stdout
=
subprocess
.
PIPE
)
while
True
:
try
:
sys
.
stdout
.
write
(
'ANDROID: '
+
log_process
.
stdout
.
readline
())
sys
.
stdout
.
flush
()
except
KeyboardInterrupt
:
break
log_reader
=
multiprocessing
.
Process
(
target
=
do_logs
)
log_reader
.
daemon
=
True
log_reader
.
start
()
return
log_reader
class
IOSDevice
(
object
):
...
...
@@ -540,6 +602,27 @@ class IOSDevice(object):
except
subprocess
.
CalledProcessError
:
pass
@
classmethod
def
logs
(
cls
):
def
do_logs
():
cmd
=
[
'idevicesyslog'
,
]
logging
.
info
(
' '
.
join
(
cmd
))
log_process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
)
while
True
:
try
:
log_line
=
log_process
.
stdout
.
readline
()
if
re
.
match
(
r'.*SkyShell.*'
,
log_line
)
is
not
None
:
sys
.
stdout
.
write
(
'IOS DEV: '
+
log_line
)
sys
.
stdout
.
flush
()
except
KeyboardInterrupt
:
break
log_reader
=
multiprocessing
.
Process
(
target
=
do_logs
)
log_reader
.
daemon
=
True
log_reader
.
start
()
return
log_reader
class
IOSSimulator
(
object
):
@
classmethod
...
...
@@ -548,6 +631,10 @@ class IOSSimulator(object):
return
False
return
cls
.
get_simulator_device_id
()
is
not
None
@
classmethod
def
is_connected
(
cls
):
return
cls
.
is_booted
()
_device_id
=
None
@
classmethod
def
get_simulator_device_id
(
cls
):
...
...
@@ -635,6 +722,29 @@ class IOSSimulator(object):
def
needs_install
(
cls
,
args
):
return
cls
.
is_booted
()
@
classmethod
def
logs
(
cls
):
def
do_logs
():
cmd
=
[
'tail'
,
'-f'
,
os
.
path
.
expanduser
(
'~/Library/Logs/CoreSimulator/'
+
cls
.
get_simulator_device_id
()
+
'/system.log'
),
]
logging
.
info
(
' '
.
join
(
cmd
))
log_process
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
)
while
True
:
try
:
log_line
=
log_process
.
stdout
.
readline
()
if
re
.
match
(
r'.*SkyShell.*'
,
log_line
)
is
not
None
:
sys
.
stdout
.
write
(
'IOS SIM: '
+
log_line
)
sys
.
stdout
.
flush
()
except
KeyboardInterrupt
:
break
log_reader
=
multiprocessing
.
Process
(
target
=
do_logs
)
log_reader
.
daemon
=
True
log_reader
.
start
()
return
log_reader
@
classmethod
def
fork_install_app
(
cls
,
ios_app_path
):
cmd
=
[
...
...
@@ -1045,7 +1155,7 @@ class SkyShellRunner(object):
subparsers
=
parser
.
add_subparsers
(
help
=
'sub-command help'
)
for
command
in
[
InstallSky
(),
StartSky
(),
StopSky
(),
StartListening
(),
StartTracing
(),
StopTracing
(),
IOSSimulator
()]:
for
command
in
[
SkyLogs
(),
InstallSky
(),
StartSky
(),
StopSky
(),
StartListening
(),
StartTracing
(),
StopTracing
(),
IOSSimulator
()]:
command
.
add_subparser
(
subparsers
)
args
=
parser
.
parse_args
()
...
...
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