Exemplo n.º 1
0
 public static bool OpenLogFile()
 {
     bool result;
     try
     {
         _logFilePath = Path.Combine(Path.GetTempPath(), "GestureSign.log");
         var sw = new StreamWriterWithTimestamp(new FileStream(_logFilePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite)) { AutoFlush = true };
         Console.SetOut(sw);
         Console.SetError(sw);
         result = true;
     }
     catch (IOException e)
     {
         Console.WriteLine(e.ToString());
         result = false;
     }
     return result;
 }
Exemplo n.º 2
0
        public static bool OpenLogFile()
        {
            try
            {
                LogFilePath = GetTempPath("icityservices.log");

                _fs           = new FileStream(LogFilePath, FileMode.Append);
                _sw           = new StreamWriterWithTimestamp(_fs);
                _sw.AutoFlush = true;
                Console.SetOut(_sw);
                Console.SetError(_sw);

                return(true);
            }
            catch (IOException e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }
        }
Exemplo n.º 3
0
        public static bool OpenLogFile()
        {
            bool result;

            try
            {
                _logFilePath = Path.Combine(Path.GetTempPath(), "GestureSign.log");
                var sw = new StreamWriterWithTimestamp(new FileStream(_logFilePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite))
                {
                    AutoFlush = true
                };
                Console.SetOut(sw);
                Console.SetError(sw);
                result = true;
            }
            catch (IOException e)
            {
                Console.WriteLine(e.ToString());
                result = false;
            }
            return(result);
        }
Exemplo n.º 4
0
        public static bool OpenLogFile()
        {
            bool result;

            try
            {
                _logFilePath = Path.Combine(AppConfig.LocalApplicationDataPath, "GestureSign.log");
                CheckLogSize(_logFilePath);
                var sw = new StreamWriterWithTimestamp(new FileStream(_logFilePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite))
                {
                    AutoFlush = true
                };
                Console.SetOut(sw);
                Console.SetError(sw);
                result = true;
            }
            catch (Exception e)
            {
                LogAndNotice(e);
                result = false;
            }
            return(result);
        }