Skip to content

Commit

Permalink
Add git branch and commit when log is initialized to help debug (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
ademar111190 authored Oct 19, 2023
1 parent e0ef3af commit 0cff506
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
29 changes: 3 additions & 26 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
constant_identifier_names: false
use_key_in_widget_constructors: false
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

analyzer:
exclude:
- lib/services/breez_server/generated/**
- lib/services/lightning/greenlight/cmd.dart
- lib/generated_plugin_registrant.dart
- lib/generated_plugin_registrant.dart
errors:
asset_directory_does_not_exist: ignore
5 changes: 5 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.apache.tools.ant.DirectoryScanner

include ':app'

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
Expand All @@ -9,3 +11,6 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

DirectoryScanner.removeDefaultExclude('**/.git')
DirectoryScanner.removeDefaultExclude('**/.git/**')
7 changes: 7 additions & 0 deletions lib/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:io';
import 'package:archive/archive_io.dart';
import 'package:breez_sdk/breez_sdk.dart';
import 'package:flutter/foundation.dart';
import 'package:git_info/git_info.dart';
import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
Expand Down Expand Up @@ -60,6 +61,12 @@ class BreezLogger {
final exception = details.exceptionAsString();
_log.severe("$exception -- $name", details, details.stack);
};

GitInfo.get().then((it) {
_log.info("Logging initialized, app build on ${it.branch} at commit ${it.hash}");
}, onError: (error) {
_log.severe("Failed to get git info", error);
});
}

/// Log entries according to their severity
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.6.0"
git_info:
dependency: "direct main"
description:
name: git_info
sha256: f00efd20ff8f084e7910afa071606c025eb4848db40000256cc1996427cf798b
url: "https://pub.dev"
source: hosted
version: "1.1.2"
glob:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies:
git:
url: https://github.com/breez/flutter_typeahead.git
ref: a16aa4deeff1c5e96c6da46da31cb0533f838d8d
git_info: ^1.1.2
hex: ^0.2.0
http: <1.0.0 # Requires Flutter 3.10
hydrated_bloc: ^9.1.2
Expand Down Expand Up @@ -123,6 +124,8 @@ flutter:
- src/animations/welcome/
- assets/images/
- assets/icons/
- .git/
- .git/refs/heads/
fonts:
- family: IBMPlexSans
fonts:
Expand Down

0 comments on commit 0cff506

Please sign in to comment.