A Google Stackdriver logging plugin for the cable logging framework.
Add cable_stackdriver
in your [`pubspec.yaml`][pubspec] file:
dependencies:
cable_stackdriver: ^0.1.0
And that's it! See usage for details.
You can use Stackdriver on the server with a Google Cloud service account.
Once you have a <key>.json
file, with the scope
https://www.googleapis.com/auth/logging.write
...you can create a Stackdriver
object:
import 'dart:async';
import 'package:cable_stackdriver/cable_stackdriver.dart';
Future<Null> main() async {
final jsonConfig = loadJsonFile();
final stackdriver = await Stackdriver.serviceAccount<String>(
jsonConfig,
logName: 'projects/${jsonConfig['project_id']}/logs/example',
);
final logger = new Logger(
destinations: [
// Also write to console.
stackdriver,
],
);
// You can now use the logger.
logger.log('Hello World', severity: Severity.warning);
// Wait until there are no more pending messages being written.
await stackdriver.onIdle;
logger.close();
}
We welcome a diverse set of contributions, including, but not limited to:
For the stability of the API and existing users, consider opening an issue first before implementing a large new feature or breaking an API. For smaller changes (like documentation, minor bug fixes), just send a pull request.
All pull requests are validated against travis, and must pass.
Ensure code passes all our analyzer checks:
$ dartanalyzer .
Ensure all code is formatted with the latest dev-channel SDK.
$ dartfmt -w .
Run all of our unit tests (IN PROGRESS):
$ pub run test
Added a logName
parameter, which is @required
to use Stackdriver. Before
we used Logger.name
, but that was both awkward and not technically correct.
Log entries are buffered, and messages collected within a second are sent
together. It is possible to change (or disable) this feature by setting
the buffer
duration.
Add this to your package's pubspec.yaml file:
dependencies:
cable_stackdriver: "^0.1.1"
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:cable_stackdriver/cable_stackdriver.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.1.1 | Nov 24, 2017 |
|
|
0.1.0 | Oct 21, 2017 |
|
|
We analyzed this package on Apr 9, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
0 | / 100 |
Health:
Code health derived from static analysis.
[more]
|
98 | / 100 |
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
100 | / 100 |
Overall score:
Weighted score of the above.
[more]
|
49 |
Detected platforms: Flutter, other
Primary library:
package:cable_stackdriver/cable_stackdriver.dart
with components:io
.
The description is too short.
Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.
Package is pre-v1 release.
While there is nothing inherently wrong with versions of
0.*.*
, it usually means that the author is still experimenting with the general direction API.
Fix analysis and formatting issues.
Analysis or formatting checks reported 2 hints.
Run
dartfmt
to formatlib/cable_stackdriver.dart
.
Maintain an example.
None of the files in your
example/
directory matches a known example patterns. Common file name patterns include:main.dart
,example.dart
or you could also usecable_stackdriver.dart
.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.25.0-dev <2.0.0 | ||
cable | ^0.1.0 | 0.1.0+1 | |
googleapis | ^0.44.0 | 0.44.0 | 0.50.0 |
googleapis_auth | ^0.2.0 | 0.2.5 | |
http | ^0.11.0 | 0.11.3+16 | |
meta | ^1.1.0 | 1.1.2 | |
Transitive dependencies | |||
_discoveryapis_commons | 0.1.5 | ||
async | 2.0.6 | ||
charcode | 1.1.1 | ||
collection | 1.14.9 | ||
convert | 2.0.1 | ||
crypto | 2.0.2+1 | ||
http_parser | 3.1.1 | ||
path | 1.5.1 | ||
source_span | 1.4.0 | ||
string_scanner | 1.0.2 | ||
typed_data | 1.1.5 |