/// <summary> /// 获取当前运行的代码信息作为日志的Tag /// 格式为 文件名-方法名-代码所在行数 /// </summary> /// <param name="skipFrames"></param> /// <returns></returns> public static string GetTag(int skipFrames = 2) { StackFrame frame = new StackFrame(skipFrames, true); var lineNumber = StackTraceHelper.GetLineNumber(frame); var method = StackTraceHelper.GetMethod(frame); var fileName = StackTraceHelper.GetFileNameWithoutPath(frame); return(string.Format("{0}-{1}-{2}", fileName, method, lineNumber)); }