示例#1
0
        public void Put(string pLogName, string pMessage)
        {
            object obj = this._List[pLogName];
            _Log   log = default(_Log);

            if (obj == null)
            {
                // Bloqueamos la hashtable de logs por si otro thread está insertando logs al mismo tiempo
                lock (this)
                {
                    // Volvemos a comprobar que mientras esperabamos en lo lock no ha creado el log otro hilo
                    obj = this._List[pLogName];
                    if (obj == null)
                    {
                        log = new _Log(pLogName);
                        this._List[pLogName] = log;
                    }
                    else
                    {
                        log = (_Log)obj;
                    }
                }
            }
            else
            {
                log = (_Log)obj;
            }
            log.Put(pMessage);
        }
示例#2
0
        public static string GetLogDirectory()
        {
            try
            {
                _Log   log  = new _Log("dd_name");
                string name = log._GetLogFilename();
                return(name.Replace(@"\" + System.IO.Path.GetFileName(name), ""));
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.Write(ex.ToString());
#endif
                return(null);
            }
        }
示例#3
0
 public static string GetLogDirectory()
 {
     try
     {
         _Log log = new _Log("dd_name");
         string name = log._GetLogFilename();
         return name.Replace(@"\" + System.IO.Path.GetFileName(name), "");
     }
     catch (Exception ex)
     {
     #if DEBUG
         Console.Write(ex.ToString());
     #endif
         return null;
     }
 }
示例#4
0
 public void Put(string pLogName, string pMessage)
 {
     object obj = this._List[pLogName];
     _Log log = default(_Log);
     if (obj == null)
     {
         // Bloqueamos la hashtable de logs por si otro thread está insertando logs al mismo tiempo
         lock (this)
         {
             // Volvemos a comprobar que mientras esperabamos en lo lock no ha creado el log otro hilo
             obj = this._List[pLogName];
             if (obj == null)
             {
                 log = new _Log(pLogName);
                 this._List[pLogName] = log;
             }
             else
             {
                 log = (_Log)obj;
             }
         }
     }
     else
     {
         log = (_Log)obj;
     }
     log.Put(pMessage);
 }