Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aligorithm committed Nov 2, 2020
2 parents 67e8141 + f45d071 commit e093d91
Showing 1 changed file with 74 additions and 8 deletions.
82 changes: 74 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,80 @@
# logdna

A new Flutter package project.
A simple logdna client for Flutter. Logging made easy.

[LogDNA](https://logdna.com) is a log management platform that integrates with many platforms. All logs are accessible in a centralized dashboard with features such as analysis, monitoring, filters and alerts.

## Getting Started

This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
To get started, create an account on [logdna.com](https://logdna.com) and get your ingestion API key. The set up process is straightforward. Here's a link to the quickstart guide (https://docs.logdna.com/docs/logdna-quick-start-guide).

## Installing the package

Add this to your project's `pubspec.yaml` file

```yaml
dependencies:
logdna: ^0.0.1
```
Run `flutter pub get`


## Usage

Import the package to your Dart code

```dart
import 'package:logdna/logdna.dart';
```


Instantiate the LogDna object

```dart
logDna = LogDNA(
apiKey: "YOUR_API_KEY",
appName: "APP_NAME",
hostName: "HOSTNAME");
```


Add logs using the logDna object.

```dart
logDna.log(DnaLine(
timestamp: DateTime.now().toUtc().millisecondsSinceEpoch.toString(),
line: "event happened",
level: DnaLevel.debug,
env: DnaEnv.production,
meta: {
"custom field":"custom value",
"custom field 2": "custom value 2"
}
));
```


Alternatively, you can create the log line separately and pass it into the log method.

```dart
line = DnaLine(
timestamp: DateTime.now().toUtc().millisecondsSinceEpoch.toString(),
line: "event happened",
level: DnaLevel.debug,
env: DnaEnv.production,
meta: {
"custom field":"custom value",
"custom field 2": "custom value 2"
}
);
```

You can add custom values after creating the 'DnaLine' instance.

```dart
line.addCustomField(CustomField(name:"custom name", value: "Custom value"));
```


For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
You've pushed your log to LogDNA! Check your LogDNA dashboard. Your new log line should appear.

0 comments on commit e093d91

Please sign in to comment.