flutter 线上apm监控 远程日志 emas_tlog

emas_tlog

ali emas tlog
git地址:https://github.com/smartbackme/emas_tlog

阿里巴巴flutter版本 远程日志 TLog

介绍

远程日志服务提供远程手机日志拉取功能,解决移动App线上异常排查困难的问题。
远程日志服务支持Android/iOS应用类型。

产品架构

在这里插入图片描述

1.移动App集成SDK
2.远程日志服务通过心跳探测识别已安装App的移动终端,并进行日志拉取配置。
3.远程日志服务拉取指定移动终端App的用户日志,并对拉取任务进行管理。
4.远程日志服务查看已从终端设备拉取至控制台的用户日志。

官网地址:官网地址

本项目是根据官方来制作的flutter版本

快速开始

flutter配置:
  emas_tlog: ^0.0.1

初始化:

方法的声明:
static void init(String appKey,String appSecret,String rsaPublicKey,
      String appKeyIos,String appSecretIos,String rsaPublicKeyIos,
      {String androidChannel = "line",String userNick = "NoLogin",ApmLogType? type,bool debug = true}){
// xxxxxx
}
方法的调用:
EmasTlog.init("**", "**", "**",
        "**","**","**",
        androidChannel :"HEHE",userNick: "lalala2");

参数说明:
appKey
appSecret
rsaPublicKey
appKeyIosiOSemas.appKey
appSecretIosiOSemas.appSecret
rsaPublicKeyIosiOSappmonitor.tlog.rsaSecret
androidChannel: 渠道 (iOS指定 App Store
userNick: 用户昵称说明: 默认值NoLogin
type(*日志上传类型,注:iOS若不传,默认是I
debug(底层运行日志答应)true测试环境开启 false正式环境 关闭(iOS可不传)

*星号标记说明

V:可拉取所有级别的日志。(iOS无此类型)

D:可拉取DEBUG/INFO/WARN/ERROR级别的日志。

I:可拉取INFO/WARN/ERROR级别的日志。

W:可拉取WARN/ERROR级别的日志。

E:可拉取ERROR级别的日志。

日常使用:

方法的声明:
static void init(String appKey,String appSecret,String rsaPublicKey,
      String appKeyIos,String appSecretIos,String rsaPublicKeyIos,
      {String androidChannel = "line",String userNick = "NoLogin",ApmLogType? type,bool debug = true}){
// xxxxx
}

方法的调用:
EmasTlog.log(ApmLogType.I, "tag2_1231231",module: "hehe2_flutter",tag: "tag_hehe2");
EmasTlog.log(ApmLogType.V, "tag2_1231231",module: "hehe2_flutter",tag: "tag_hehe2");
EmasTlog.log(ApmLogType.W, "tag2_1231231",module: "hehe2_flutter",tag: "tag_hehe2");
EmasTlog.log(ApmLogType.E, "tag2_1231231",module: "hehe2_flutter",tag: "tag_hehe2");
EmasTlog.log(ApmLogType.D, "tag2_1231231",module: "hehe2_flutter",tag: "tag_hehe2");
EmasTlog.log(ApmLogType.I, "tag2_1231231",module: "hehe2_flutter",tag: "tag_hehe2");

说明:
module为模块业务,可以为空

    EmasTlog.comment(); 主动上传日志
    EmasTlog.updateNickName(name) 修改用户名(用于登录切换用户)
Android配置:

1、在根项目Android目录build.gradle配置如下代码


ext {
    tlog = [
            openUtdid     : true
    ]
}

说明:
如果项目编译期报类似如下错误


Duplicate class com.ta.utdid2.a.a.a found in modules jetified-alicloud-android-utdid-2.5.1-proguard (com.aliyun.ams:alicloud-android-utdid:2.5.1-proguard) and jetified-utdid-1.5.2.1 (com.umeng.umsdk:utdid:1.5.2.1)

则代码需要调整为


ext {
    tlog = [
            openUtdid     : false
    ]
}

配置展示:


ext {
    tlog = [
            openUtdid     : true
    ]
}

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

app AndroidManifest配置:




   

说明需要 配置 tools:replace="android:label"

iOS 的配置说明

1、在Flutter项目的iOS端的Podfile中添加如下索引库地址:

# alicloud
source "https://github.com/CocoaPods/Specs.git"
source "https://github.com/aliyun/aliyun-specs.git"

2、在Flutter项目的iOS端的info.plist文件中添加如下代码:

NSAppTransportSecurity
    
        NSAllowsArbitraryLoads
        
    
NSBonjourServices
    
        _dartobservatory._tcp
    
NSLocalNetworkUsageDescription
Main

3、在iOS端项目Build Setting中,将Allow Non-modular Includes In Framework Modules设置为YES

你可能感兴趣的:(flutter 线上apm监控 远程日志 emas_tlog)