simple_log 1.2.1 copy "simple_log: ^1.2.1" to clipboard
simple_log: ^1.2.1 copied to clipboard

outdated

The simplest way to upload logs to remote server, support all platforms.

Language: English | 中文

simple_log #

Pub Version Platform

The simplest way to upload logs to remote server, support all platforms.

By default, logs will be uploaded to avenge.app, which is a simple Log-Management-System, welcome to try ^_^

You can set your own server to receive logs.

Getting Started #

  1. Register for free

    https://avenge.app/register

  2. Create app

    https://avenge.app/home/resources/apps/new

  3. Install

    dependencies:
        simple_log: ^1.2.1
    
  4. Usage

    import 'package:simple_log/simple_log.dart';
    
    void main(){
      SimpleLog logger = SimpleLog(appId: yourAppId, appKey: 'yourAppKey');
      FlutterError.onError = (FlutterErrorDetails details) {
        logger.e(details);
      };
      runApp(MyApp());
    }
    
  5. Other usages

    simple_logger_example.dart

    SimpleLog logger = SimpleLog(appId: 123, appKey: 'yourAppKey');
    SimpleLog logger2 = SimpleLog(key: 'key2',appId: 456, appKey: 'yourAppKey2');
      
    // default key is 'default'
    assert(logger == SimpleLog(key: 'default'));
      
    // debug level
    logger.d('hello world');
      
    // info level
    logger.i('hello world');
      
    // warning level
    logger.w({'a':1,'b':'c'}); 
      
    // error level log will be printed on the local terminal
    logger2.setPrintLevels([Level.Error]);
      
    // error level
    // this log will be printed on the local terminal
    logger2.e(logger); 
      
    // cancel upload logs
    logger2.setUploadLevels(null);
      
    // fatal level
    // this log will be printed on the local terminal but will not be uploaded
    logger2.f(['p1', 'p2']); 
    

Build receive server #

The default value of [SimpleLog.apiPrefix] is 'https://avenge.app/api', you can set your own server to receive logs.

var logger = SimpleLog(apiPrefix: 'your own server');

When it reports a log, it will post a json to remote server:

{
  "app_id": 123,
  "app_key": "appKey123",
  "user": "user123",
  "flag": "flag123",
  "level": 2,
  "data": {}
}

data is the content of the log, it can be string or json.

Then, the remote server will give back a json:

{
  "code": 0,
  "message": "success"
}

If code is 0, it means success.

If something went wrong, it would be:

{
  "code": -1,
  "message": "something wrong ..."
}

全部项目 #

插件 状态 描述
simple_log Pub Version 最简单的日志收集方式,支持所有平台
simple_update Pub Version 最简单的应用更新方式,支持所有平台
1
likes
0
pub points
0%
popularity

Publisher

verified publisheravenge.app

The simplest way to upload logs to remote server, support all platforms.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio

More

Packages that depend on simple_log