Skip to content

Commit

Permalink
fix: preparing package for initial public release
Browse files Browse the repository at this point in the history
  • Loading branch information
Joran-Dob committed Jan 26, 2023
1 parent e5b4111 commit a7bf908
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 45 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0+1] - 2023-01-26

### Added

- Initial release.
- Support for LogSnag insights.
- Support for LogSnag logs.

[0.1.0+1]: https://github.com/Joran-Dob/logsnag/releases/tag/v0.1.0
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2023 Joran Dob

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
74 changes: 41 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

![LogSnag](https://logsnag.com/og-image.png "LogSnag")

# LogSnag

[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)
[![License: MIT][license_badge]][license_link]

A Very Good Project created by Very Good CLI.

## Installation 💻

**❗ In order to start using Logsnag you must have the [Dart SDK][dart_install_link] installed on your machine.**
Expand All @@ -14,7 +13,7 @@ Add `logsnag` to your `pubspec.yaml`:

```yaml
dependencies:
logsnag:
logsnag: {version}
```
Install it:
Expand All @@ -25,45 +24,54 @@ dart pub get

---

## Continuous Integration 🤖

Logsnag comes with a built-in [GitHub Actions workflow][github_actions_link] powered by [Very Good Workflows][very_good_workflows_link] but you can also add your preferred CI/CD solution.
## Usage 🚀

Out of the box, on each pull request and push, the CI `formats`, `lints`, and `tests` the code. This ensures the code remains consistent and behaves correctly as you add functionality or make changes. The project uses [Very Good Analysis][very_good_analysis_link] for a strict set of analysis options used by our team. Code coverage is enforced using the [Very Good Workflows][very_good_coverage_link].
### Initialization

---
To initialize Logsnag, import the `logsnag` package and create a new instance of `Logsnag`:

## Running Tests 🧪
```dart
import 'package:logsnag/logsnag.dart';
To run all unit tests:
void main() {
final logSnag = LogSnag(
project: {project},
token: {token},
);
}
```

```sh
dart pub global activate coverage 1.2.0
dart test --coverage=coverage
dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info
### Logging

To send a log, use the `log` method:

```dart
logSnag.log(
channel: 'test-channel',
event: 'User Joined',
description: 'Email: [email protected]',
icon: '👋',
tags: {
'name': 'john doe',
'email': '[email protected]',
},
notify: true,
);
```

To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov).
### Insight

```sh
# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/
To send an insight, use the `insight` method:

# Open Coverage Report
open coverage/index.html
```dart
logSnag.insight(
title: 'Test',
value: 'Test',
icon: '👋',
);
```

[dart_install_link]: https://dart.dev/get-dart
[github_actions_link]: https://docs.github.com/en/actions/learn-github-actions
[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license_link]: https://opensource.org/licenses/MIT
[logo_black]: https://raw.githubusercontent.com/VGVentures/very_good_brand/main/styles/README/vgv_logo_black.png#gh-light-mode-only
[logo_white]: https://raw.githubusercontent.com/VGVentures/very_good_brand/main/styles/README/vgv_logo_white.png#gh-dark-mode-only
[mason_link]: https://github.com/felangel/mason
[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg
[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis
[very_good_coverage_link]: https://github.com/marketplace/actions/very-good-coverage
[very_good_ventures_link]: https://verygood.ventures
[very_good_ventures_link_light]: https://verygood.ventures#gh-light-mode-only
[very_good_ventures_link_dark]: https://verygood.ventures#gh-dark-mode-only
[very_good_workflows_link]: https://github.com/VeryGoodOpenSource/very_good_workflows
[license_link]: https://opensource.org/licenses/MIT
2 changes: 1 addition & 1 deletion lib/src/client/logsnag_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class LogSnagApiException implements Exception {
} catch (_) {
// ignore
}
return response?.body;
return null;
}

/// The error message from the server
Expand Down
7 changes: 2 additions & 5 deletions lib/src/entities/insight_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class InsightEntity with _$InsightEntity {
String? icon,
}) = _InsightEntity;

/// Creates a new instance of [InsightEntity] from JSON
factory InsightEntity.fromJson(
Map<String, dynamic> json,
) =>
_$InsightEntityFromJson(json);
/// Initializes a new instance of [InsightEntity] from JSON
factory InsightEntity.fromJson(Map<String, dynamic> json) => _$InsightEntityFromJson(json);
}
7 changes: 2 additions & 5 deletions lib/src/entities/log_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class LogEntity with _$LogEntity {
String? parser,
}) = _LogEntity;

/// Creates a new instance of [LogEntity] from JSON
factory LogEntity.fromJson(
Map<String, dynamic> json,
) =>
_$LogEntityFromJson(json);
/// Initializes a new instance of [LogEntity] from JSON
factory LogEntity.fromJson(Map<String, dynamic> json) => _$LogEntityFromJson(json);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: logsnag
description: A Very Good Project created by Very Good CLI.
version: 0.1.0+1
publish_to: none
repository: https://github.com/Joran-Dob/logsnag/

environment:
sdk: ">=2.18.0 <3.0.0"
Expand Down

0 comments on commit a7bf908

Please sign in to comment.