Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: pkg/fasta/bin/log_analyzer.dart

Issue 2636523002: Fasta logging. (Closed)
Patch Set: Removed analyze_apache_log.dart. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/fasta/bin/log_collector.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:convert' show
6 JSON;
7
8 import 'dart:io';
9
10 import 'package:testing/src/run_tests.dart' show
11 CommandLine;
12
13 main(List<String> arguments) async {
14 CommandLine cl = CommandLine.parse(arguments);
15 Set<String> fields = cl.commaSeparated("--fields=");
16 if (fields.isEmpty) {
17 fields.addAll(["uri", "offset", "json:error"]);
18 }
19 for (String filename in cl.arguments) {
20 String json = await new File(filename).readAsString();
21 Map<String, dynamic> data = JSON.decode(json) as Map<String, dynamic>;
22 StringBuffer sb = new StringBuffer();
23 bool isFirst = true;
24 for (String field in fields) {
25 if (!isFirst) {
26 sb.write(":");
27 }
28 if (field.startsWith("json:")) {
29 field = field.substring(5);
30 sb.write(JSON.encode(data[field]));
31 } else {
32 sb.write(data[field]);
33 }
34 isFirst = false;
35 }
36 print("$sb");
37 }
38 }
OLDNEW
« no previous file with comments | « no previous file | pkg/fasta/bin/log_collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698