Chromium Code Reviews| Index: dart/pkg/microlytics/example/simple.dart |
| diff --git a/dart/pkg/microlytics/example/simple.dart b/dart/pkg/microlytics/example/simple.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2e74d15b85b9f332d5b0ccea2439f5e8127c0768 |
| --- /dev/null |
| +++ b/dart/pkg/microlytics/example/simple.dart |
| @@ -0,0 +1,26 @@ |
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +import 'package:microlytics/channels.dart'; |
| +import 'package:microlytics/io_channels.dart'; |
| +import 'package:microlytics/microlytics.dart'; |
| + |
| +void main(List<String> arguments) { |
| + // Create the channel that will be used to communicate to analytics. |
| + var channel = new RateLimitingBufferedChannel( |
| + new HttpClientChannel(), packetsPerSecond: 1.0); |
| + |
| + if (arguments.length != 1) { |
| + print("usage: dart simple.dart GA-Client-ID"); |
| + return; |
| + } |
| + final String CLIENT_ID = arguments.single; |
|
ahe
2014/09/05 07:51:36
Not a constant anymore, so use lowercaseCamelCase.
|
| + |
| + // Create the logger. |
| + var lg = new AnalyticsLogger(channel, "555", CLIENT_ID, "test", "1.2"); |
| + |
| + // Send some messages. |
| + lg.logAnonymousEvent("hello", "world"); |
| + lg.logAnonymousTiming("loader", "var", 42); |
| +} |