logs.dart 914 Bytes
Newer Older
1 2 3 4 5 6
// 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.

import 'dart:async';

7
import '../device.dart';
8
import '../runner/flutter_command.dart';
9

10
class LogsCommand extends FlutterCommand {
11 12
  final String name = 'logs';
  final String description = 'Show logs for running Sky apps.';
13

14
  LogsCommand() {
15 16
    argParser.addFlag('clear',
        negatable: false,
17
        abbr: 'c',
18 19 20
        help: 'Clear log history before reading from logs (Android only).');
  }

21 22
  bool get requiresProjectRoot => false;

23
  @override
24
  Future<int> runInProject() async {
25
    connectToDevices();
26

27
    bool clear = argResults['clear'];
28

29 30
    Iterable<Future<int>> results = devices.all.map(
        (Device device) => device.logs(clear: clear));
31

32 33
    for (Future<int> result in results)
      await result;
34

35 36 37
    return 0;
  }
}