コード例 #1
0
ファイル: Log.cs プロジェクト: shirriff/IFS
        public static void Write(LogType type, LogComponent component, string message, params object[] args)
        {
            if ((_type & type) != 0 &&
                (_components & component) != 0)
            {
                //
                // My log has something to tell you...
                Console.WriteLine("[" + DateTime.Now + "] " + component.ToString() + ": " + message, args);

                if (_logStream != null)
                {
                    _logStream.WriteLine(component.ToString() + ": " + message, args);
                }
            }
        }
コード例 #2
0
ファイル: Log.cs プロジェクト: chandrab/ContrAlto
        public static void Write(LogType type, LogComponent component, string message, params object[] args)
        {
            if ((_type & type) != 0 &&
                (_components & component) != 0)
            {
                //
                // My log has something to tell you...
                // TODO: color based on type, etc.
                Console.WriteLine(component.ToString() + ": " + message, args);

                if (_logStream != null)
                {
                    _logStream.WriteLine(component.ToString() + ": " + message, args);
                }
            }
        }
コード例 #3
0
ファイル: Logger.cs プロジェクト: Dzoni1999/RES
        public static void LogError(LogComponent component, DateTime timestamp)
        {
            string line = string.Format($"[{timestamp}] {component.ToString()} ERROR");

            StreamWriter sw;

            lock (syncLock)
            {
                if (!File.Exists(filename))
                {
                    sw = File.CreateText(filename);
                }
                else
                {
                    sw = File.AppendText(filename);
                }

                sw.WriteLine(line);

                sw.Close();
            }
        }