Cgw.NLogEx.LoggerEx.Error C# (CSharp) Method

Error() public method

带异常信息的Error类日志输出。
public Error ( Exception e, string message ) : void
e System.Exception e
message string message
return void
        public void Error(Exception e, string message, params object[] args)
        {
            if (this.Log.IsErrorEnabled)
            {
                this.WriteToLog(LogLevel.Error, e, message, args);
            }
        }

Same methods

LoggerEx::Error ( SmcErr err ) : void
LoggerEx::Error ( SmcErr err, Exception e, string message ) : void
LoggerEx::Error ( SmcErr err, string message ) : void
LoggerEx::Error ( string message ) : void

Usage Example

コード例 #1
0
ファイル: FileOperation.cs プロジェクト: eSDK/esdk_Cgw
 /// <summary>
 /// 写文件 
 /// </summary>
 /// <param name="path"></param>
 /// <param name="content"></param>
 public void WriteFile(string path,string content)
 {
     LoggerEx logEx = new LoggerEx(log);
     try
     {
         FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write);
         StreamWriter sw = new StreamWriter(fs, Encoding.Default);
         sw.Write(content);
         sw.Close();
         fs.Close();
     }
     catch (System.Exception ex)
     {
         logEx.Error("FileOperation.WriteFile failed. message:{0}", ex.ToString());
     }
 }