码迷,mamicode.com
首页 > 其他好文 > 详细

flutter 日志工具类

时间:2019-09-21 21:24:11      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:sre   sage   environ   debug   rom   except   new   工具   message   

class LogUtils {
//dart.vm.product 环境标识位 Release为true debug 为false
static const bool isRelease = const bool.fromEnvironment("dart.vm.product"); static void d(String tag, Object message) { if (!isRelease) _printLog(tag, ‘D -> ‘, message); } static void i(String tag, Object message) { _printLog(tag, ‘I -> ‘, message); } static void e(String tag, Object message, {Exception e}) { _printLog(tag, ‘E -> ‘, message); } static void _printLog(String tag, String level, Object message) { StringBuffer sb = new StringBuffer(); sb..write(level)..write(tag ?? ‘‘)..write(‘: ‘)..write(message); print(sb.toString()); } }

 

flutter 日志工具类

标签:sre   sage   environ   debug   rom   except   new   工具   message   

原文地址:https://www.cnblogs.com/loaderman/p/11532318.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!