Add Logger

This commit is contained in:
LollipopKit
2021-10-25 17:31:35 +08:00
parent b5f5fe2dfc
commit 44e9780e5a
6 changed files with 35 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:logging/logging.dart';
import 'package:ssh2/ssh2.dart';
import 'package:toolbox/core/extension/stringx.dart';
import 'package:toolbox/core/provider_base.dart';
@@ -15,6 +16,8 @@ class ServerProvider extends BusyProvider {
List<ServerInfo> _servers = [];
List<ServerInfo> get servers => _servers;
final logger = Logger('ServerProvider');
ServerStatus get emptyStatus => ServerStatus(
cpuPercent: 0,
memList: [100, 0],
@@ -92,7 +95,11 @@ class ServerProvider extends BusyProvider {
final client = _servers[idx].client;
final connected = await client.isConnected();
if (!connected) {
final time1 = DateTime.now();
await client.connect();
final time2 = DateTime.now();
logger.info(
'Connected to [${info.name}] in [${time2.difference(time1).toString()}].');
}
final cpu = await client.execute(
"top -bn1 | grep load | awk '{printf \"%.2f\", \$(NF-2)}'") ??

View File

@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ToolBox";
static const int build = 15;
static const int build = 18;
static const String engine =
"Flutter 2.5.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ffb2ecea52 (2 weeks ago) • 2021-09-17 15:26:33 -0400\nEngine • revision b3af521a05\nTools • Dart 2.14.2\n";
static const String buildAt = "2021-10-02 19:52:07.676336";
static const int modifications = 71;
"Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (10 days ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n";
static const String buildAt = "2021-10-25 16:56:13.551427";
static const int modifications = 0;
}