| | |
| | | public class AliyuLogUtil |
| | | { |
| | | private static AliyuLogProducerClient exceptionProducerClient; |
| | | |
| | | private static LogBean logBean; |
| | | |
| | | private static AliyuLogProducerClient getExceptionProducerClient() |
| | |
| | | { |
| | | if (exceptionProducerClient == null) |
| | | { |
| | | if (Shared.Application.Activity == null) { |
| | | return null; |
| | | } |
| | | exceptionProducerClient = new AliyuLogProducerClient(Shared.Application.Activity, "https://cn-hangzhou.log.aliyuncs.com", "log", "event_tracking", "LTAI5tLzDxrtsFyi3xtK3YWt", "eX31JZrRAvC2wZWPiZU0SYhlfAUMoT", null, null); |
| | | exceptionProducerClient.initProducer(); |
| | | } |
| | |
| | | * 1.点击项目的时候设置 |
| | | * 2.关闭住宅页面的时候去掉 |
| | | */ |
| | | if (string.IsNullOrEmpty(getLogBean().getUserId()) || string.IsNullOrEmpty(getLogBean().getHomeId())) |
| | | if (string.IsNullOrEmpty(getLogBean.getUserId()) || string.IsNullOrEmpty(getLogBean.getHomeId())) |
| | | { |
| | | return; |
| | | } |
| | |
| | | log.PutContent("title", title); |
| | | log.PutContent("content", content); |
| | | log.PutContent("level", level.ToString()); |
| | | log.PutContent("userId", getLogBean().getUserId()); |
| | | log.PutContent("homeId", getLogBean().getHomeId()); |
| | | log.PutContent("userId", getLogBean.getUserId()); |
| | | log.PutContent("homeId", getLogBean.getHomeId()); |
| | | log.PutContent("time", System.DateTime.UtcNow + ""); |
| | | log.PutContent("userAgent", getLogBean().getUserAgent()); |
| | | log.PutContent("appVersion", getLogBean().getAppVersion()); |
| | | log.PutContent("userAgent", getLogBean.getUserAgent()); |
| | | log.PutContent("appVersion", getLogBean.getAppVersion()); |
| | | log.PutContent("type", type); |
| | | log.PutContent("exceptionBlock", exceptionBlock); |
| | | getExceptionProducerClient().sendLog(log); |
| | | |
| | | var producerClient = getExceptionProducerClient(); |
| | | if (producerClient == null) |
| | | { |
| | | return; |
| | | } |
| | | producerClient.sendLog(log); |
| | | |
| | | } |
| | | |
| | | public static LogBean getLogBean() |
| | | public static LogBean getLogBean |
| | | { |
| | | lock (logBean) |
| | | { |
| | | if (null == logBean) |
| | | { |
| | | get { |
| | | if (logBean == null) { |
| | | logBean = new LogBean(); |
| | | } |
| | | return logBean; |