one_line_logger 1.0.6
one_line_logger: ^1.0.6 copied to clipboard
A simple flutter logger plugin with a cloud hosted UI
import 'package:flutter/material.dart';
import 'package:one_line_logger/one_line_logger.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'OneLineLogger Example',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
MyHomePage({super.key});
final logger = OneLineLogger();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('OneLineLogger Example'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Tap a button to send a log to the dashboard'),
const SizedBox(height: 24),
ElevatedButton.icon(
onPressed: () {
// Example call to logger.debug
logger.debug('User clicked the debug button in example app');
},
icon: const Icon(Icons.bug_report),
label: const Text('Send Debug Log'),
),
const SizedBox(height: 16),
ElevatedButton.icon(
onPressed: () {
// Example call to logger.error
logger.error('User triggered a simulated error in example app');
},
icon: const Icon(Icons.error),
label: const Text('Send Error Log'),
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: Colors.red,
),
),
],
),
),
);
}
}