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
5e118891
Commit
5e118891
authored
Sep 29, 2015
by
Ian Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logs command and android implementation.
parent
61bfe5ce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
sky_tools.dart
packages/flutter_tools/bin/sky_tools.dart
+2
-0
device.dart
packages/flutter_tools/lib/src/device.dart
+20
-0
logs.dart
packages/flutter_tools/lib/src/logs.dart
+42
-0
No files found.
packages/flutter_tools/bin/sky_tools.dart
View file @
5e118891
...
...
@@ -13,6 +13,7 @@ import 'package:sky_tools/src/build.dart';
import
'package:sky_tools/src/cache.dart'
;
import
'package:sky_tools/src/init.dart'
;
import
'package:sky_tools/src/install.dart'
;
import
'package:sky_tools/src/logs.dart'
;
import
'package:sky_tools/src/run_mojo.dart'
;
import
'package:sky_tools/src/start.dart'
;
import
'package:sky_tools/src/stop.dart'
;
...
...
@@ -148,6 +149,7 @@ void main(List<String> args) {
..
addCommand
(
new
CacheCommand
())
..
addCommand
(
new
InitCommand
())
..
addCommand
(
new
InstallCommand
())
..
addCommand
(
new
LogsCommand
())
..
addCommand
(
new
RunMojoCommand
())
..
addCommand
(
new
StartCommand
())
..
addCommand
(
new
StopCommand
())
...
...
packages/flutter_tools/lib/src/device.dart
View file @
5e118891
...
...
@@ -317,6 +317,26 @@ class AndroidDevice extends _Device {
return
true
;
}
void
clearLogs
()
{
runSync
([
adbPath
,
'logcat'
,
'-c'
]);
}
Future
<
int
>
logs
({
bool
clear:
false
})
{
if
(
clear
)
{
clearLogs
();
}
return
runCommandAndStreamOutput
([
adbPath
,
'logcat'
,
'-v'
,
'tag'
,
// Only log the tag and the message
'-s'
,
'sky'
,
'chromium'
,
]);
}
@override
bool
isConnected
()
=>
_hasValidAndroid
;
}
packages/flutter_tools/lib/src/logs.dart
0 → 100644
View file @
5e118891
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library
sky_tools
.
logs
;
import
'dart:async'
;
import
'package:args/command_runner.dart'
;
import
'package:logging/logging.dart'
;
import
'package:sky_tools/src/device.dart'
;
final
Logger
_logging
=
new
Logger
(
'sky_tools.logs'
);
class
LogsCommand
extends
Command
{
final
name
=
'logs'
;
final
description
=
'Show logs for running Sky apps.'
;
AndroidDevice
android
=
null
;
LogsCommand
([
this
.
android
])
{
argParser
.
addFlag
(
'clear'
,
negatable:
false
,
help:
'Clear log history before reading from logs (Android only).'
);
if
(
android
==
null
)
{
android
=
new
AndroidDevice
();
}
}
@override
Future
<
int
>
run
()
async
{
Future
<
int
>
androidLogProcess
=
null
;
if
(
android
.
isConnected
())
{
androidLogProcess
=
android
.
logs
(
clear:
argResults
[
'clear'
]);
}
if
(
androidLogProcess
!=
null
)
{
await
androidLogProcess
;
}
return
0
;
}
}
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