コード例 #1
0
ファイル: DDD.cs プロジェクト: netpyoung/UnityXConsole
    static void _Log(string message, LOG_TYPE log_type)
    {
        var st = new StackTrace(true);
        var sf = st.GetFrame(2);

        var fpath = sf.GetFileName();
        var fline = sf.GetFileLineNumber();

        XCon.Inst.Log(new LogData{message= message, fpath= fpath, fline= fline, log_type= log_type});
    }
コード例 #2
0
        public static void Trace(LOG_TYPE logType, Int64 groupId, string message,
                                 [CallerMemberName] string callerName   = null,
                                 [CallerFilePath] string callerFilePath = null,
                                 [CallerLineNumber] int lineNumber      = 0)
        {
            var index = (int)logType - (int)LOG_TYPE.START_TRACE;

            if (EnableTraceTypeIndexList[index] == false)
            {
                return;
            }

            AddLog(OP_LOG_LEVEL.TRACE, logType, groupId, message,
                   callerName, ShortFilePathName(callerFilePath), lineNumber);
        }
コード例 #3
0
ファイル: CEzLog.cs プロジェクト: chamto/pudPractice
		//파일쓰기
		public void Log( string str, LOG_TYPE LogType = LOG_TYPE.NONE )
		{
			//CNetLog.AssertX(null != str, "null != str");
			
			string strMessage;
			if (LOG_TYPE.NONE == LogType)
			{
				WriteLine(str);
				return;
			}
			else if( LOG_TYPE.INFO == LogType )
			{
				strMessage = String.Format("[INFO]{0}", str);
			}
			else
			{//타입이 안정해지면 다 ERROR 타입으로
				strMessage = String.Format("[ERROR]{0}", str);
			}
			WriteLine(strMessage);
		}
コード例 #4
0
 private void LOG(LOG_TYPE logtype, ConsoleColor? fg_color, string format, params object[] args)
 {
     Log log;
     if (m_DicLogs.TryGetValue((int)logtype, out log)) {
       string str;
       if (args.Length > 0) {
     str = string.Format(format, args);
       } else {
     str = format;
       }
       log.LOG(str);
       lock (m_ConsoleLock)
       {
     Console.ForegroundColor = null != fg_color ? (ConsoleColor)fg_color : s_default_cc_[(int)logtype];
     Console.WriteLine(str);
     Console.ResetColor();
       }
     } else {
       throw (new Exception("LOG error!!!!!"));
     }
 }
コード例 #5
0
 // see System.ConsoleColor for color names
 public static void Log(LOG_TYPE logtype, ConsoleColor cc, string format, params object[] args)
 {
     LogSys.Instance.LOG(logtype, cc, format, args);
 }
コード例 #6
0
 public static void Log(LOG_TYPE logtype, string format, params object[] args)
 {
     LogSys.Instance.LOG(logtype, null, format, args);
 }
コード例 #7
0
ファイル: DaoAccess.cs プロジェクト: migocorp/event-checkin
        public bool MakeActionLog(LOG_TYPE typeLog, string guestId)
        {
            string sql = "INSERT INTO [t_log] (logtime, guest_id, log_type) VALUES (getdate(), @guestId, @typeLog);";

            SqlParameter[] parms = new SqlParameter[2];
            parms[0] = new SqlParameter("guestId", SqlDbType.NVarChar);
            parms[0].Value = guestId;
            parms[1] = new SqlParameter("typeLog", SqlDbType.SmallInt);
            parms[1].Value = (int)typeLog;

            int iInserted = SqlHelper.ExecuteNonQuery(getSqlConnStr(), CommandType.Text, sql, parms);

            if (iInserted == 1)
                return true;
            else
                return false;
        }
コード例 #8
0
ファイル: LogWriter.cs プロジェクト: Daedalus2051/Logger
        /// <summary>
        /// Writes data to the log file specified in the constructor.
        /// </summary>
        /// <param name="logtype">Used from the LOG_TYPE enumeration to determine whether the log is verbose, info, error, etc...</param>
        /// <param name="message">This is the data that will be written to the log.</param>
        /// <param name="code_local">Optional. This is the location of the code where the information is being logged.</param>
        /// <returns>True/False depending on if the write is successful.</returns>
        public bool WriteLog(LOG_TYPE logtype, string message, [CallerFilePath]string codeName=null, [CallerMemberName]string code_local=null)
        {
            string full_path = _path + "\\" + _name;
            string codefile = codeName.Split('\\').Last();
            try
            {
                StreamWriter log_writer = new StreamWriter(full_path, true);
                //Date [LOG_TYPE]   Message (Code location)
                if (logtype == LOG_TYPE.VERBOSE)
                {
                    Console.WriteLine($"Out>[{logtype}]\t{message}\t({codefile}->{code_local})");
                    log_writer.WriteLine($"{System.DateTime.Now}[{logtype}]\t{message}\t({codefile}->{code_local})");
                }
                else
                {
                    log_writer.WriteLine($"{System.DateTime.Now}[{logtype}]\t{message}\t({codefile}->{code_local})");
                }
                log_writer.Close();

                return true;
            }
            catch (Exception err)
            {
                errormsg = "[Log>>WriteLog]: " + err.Message;
                return false;
            }
        }
コード例 #9
0
ファイル: loging.cs プロジェクト: adoggie/TCE
 private RpcLogger(string name = "" )
 {
     this.name = name;
     _loglevel = LOG_TYPE.DEBUG;
     _loghandlers = new Dictionary<string, RpcLogHandler>();
 }
コード例 #10
0
ファイル: loging.cs プロジェクト: adoggie/TCE
 public RpcLogger setLevel(LOG_TYPE type)
 {
     _loglevel = type;
     return this;
 }
コード例 #11
0
ファイル: loging.cs プロジェクト: adoggie/TCE
        public RpcLogger print(string msg, LOG_TYPE type)
        {
            if (_loglevel > type) {
                return this;
            }
            string typestr = "";
            if (type == LOG_TYPE.DEBUG) typestr = "DEBUG";
            if (type == LOG_TYPE.INFO) typestr = "INFO";
            if (type == LOG_TYPE.WARN) typestr = "WARN";
            if (type == LOG_TYPE.ERROR) typestr = "ERROR";

            msg = string.Format("{0} {1}  {2}", DateTime.UtcNow,typestr,msg);

            foreach ( KeyValuePair<string,RpcLogHandler> kv in this._loghandlers) {
                kv.Value.write( msg );
            }
            return this;
        }
コード例 #12
0
ファイル: XCon.cs プロジェクト: kkossu/testResource
 Color getColorFromLogType(LOG_TYPE log_type)
 {
     switch (log_type) {
     case LOG_TYPE.NORMAL : return this.color_normal;
     case LOG_TYPE.WARNING: return this.color_warning;
     case LOG_TYPE.ERROR  : return this.color_error;
     default              : return Color.white;
     }
 }
コード例 #13
0
 private void add_log(string log, LOG_TYPE log_type)
 {
     FlowDocument doc = this.rtbLog.Document;// new FlowDocument();
     Paragraph p = new Paragraph();  // Paragraph 类似于 html 的 P 标签
     SolidColorBrush br = new SolidColorBrush();
     
     switch (log_type)
     {
         case LOG_TYPE.kNormalInfo:
             br.Color = Color.FromRgb(0, 0, 0);
             break;
         case LOG_TYPE.kWarnning:
             br.Color = Color.FromRgb(255, 255, 0);
             break;
         case LOG_TYPE.kSuccess:
             br.Color = Color.FromRgb(0, 255, 0);
             break;
         case LOG_TYPE.kError:
             br.Color = Color.FromRgb(255, 0, 0);
             break;
     }
     p.Foreground = br;
     Run r = new Run(log);      // Run 是一个 Inline 的标签
     p.Inlines.Add(r);
     doc.Blocks.Add(p);
     //this.rtbLog.Document = doc;
 }
コード例 #14
0
 /// <summary>
 /// 实例化一个采用默认值的日志请求信息类
 /// </summary>
 public LogRequestInformation( ) {
     LogType = LOG_TYPE.Manager;
     StartTime = DateTime.Today.AddDays( 0 );
     EndTime = DateTime.Today;
 }