Ejemplo n.º 1
0
        public static void LogError(this ILogTag obj, string format, params object[] args)
        {
            string message = GetLogText(GetLogTag(obj), GetLogCaller(), string.Format(format, args));

            Internal_LogError(Prefix + message);
            LogToFile("[E]" + message, EnableErrorStack);
        }
Ejemplo n.º 2
0
        public static void LogWarning(this ILogTag obj, string format, params object[] args)
        {
            string message = GetLogText(GetLogTag(obj), GetLogCaller(), string.Format(format, args));

            Internal_LogWarning(Prefix + message);
            LogToFile("[W]" + message);
        }
Ejemplo n.º 3
0
        public static void Log(this ILogTag obj, string message = "")
        {
            if (!Debuger.EnableLog)
            {
                return;
            }

            message = GetLogText(GetLogTag(obj), GetLogCaller(), message);
            Internal_Log(Prefix + message);
        }
Ejemplo n.º 4
0
        public static void Log(this ILogTag obj, string format, params object[] args)
        {
            if (!Debuger.EnableLog)
            {
                return;
            }

            string message = GetLogText(GetLogTag(obj), GetLogCaller(), string.Format(format, args));

            Internal_Log(Prefix + message);
        }
Ejemplo n.º 5
0
 public static void SetTag(ILogTag tag)
 {
     if (tag == null)
     {
         return;
     }
     lock (threadTags)
     {
         threadTags[Thread.CurrentThread.ManagedThreadId] = tag;
     }
 }
Ejemplo n.º 6
0
        public static void LogVerbose(this ILogTag obj, string message = "")
        {
            if (!EnableLog || !EnableLogVerbose)
            {
                return;
            }

            message = GetLogText(GetLogTag(obj), GetLogCaller(), message);
            Internal_Log(Prefix + message);
            LogToFile("[I]" + message);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the StandardSocket class
 /// </summary>
 public BaseSocket(
     AddressFamily addressFamily,
     SocketType socketType,
     ProtocolType protocolType,
     ILogTag logTag
     )
 {
     this.addressFamily = addressFamily;
     this.socketType    = socketType;
     this.protocolType  = protocolType;
     this.logTag        = logTag;
 }
Ejemplo n.º 8
0
        public static void LogVerbose(this ILogTag obj, string format, params object[] args)
        {
            if (!EnableLog || !EnableLogVerbose)
            {
                return;
            }

            string message = GetLogText(GetLogTag(obj), GetLogCaller(), string.Format(format, args));

            Internal_Log(Prefix + message);
            LogToFile("[I]" + message);
        }
Ejemplo n.º 9
0
        private static string GetLogTag(ILogTag obj)
        {
            return(obj.LOG_TAG);

            /*
             * ILogTag tag = obj as ILogTag;
             * if (tag != null)
             * {
             *  return tag.LOG_TAG;
             * }
             * return obj.GetType().Name;
             */
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the StandardSocket class
 /// </summary>
 public StandardSocket(
     AddressFamily addressFamily,
     SocketType socketType,
     ProtocolType protocolType,
     ILogTag logTag
     )
     : base(addressFamily, socketType, protocolType, logTag)
 {
     socket         = new Socket(addressFamily, socketType, protocolType);
     socket.NoDelay = true;
     try
     {
         socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, SOCKET_BUFFER_SIZE);
         socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, SOCKET_BUFFER_SIZE);
     }
     catch (Exception ex)
     {
         log.Warn("Failed to set socket buffers: " + ex.Message);
     }
 }
Ejemplo n.º 11
0
 public static void LogError(this ILogTag obj, string message)
 {
     message = GetLogText(GetLogTag(obj), GetLogCaller(), message);
     Internal_LogError(Prefix + message);
     LogToFile("[E]" + message, EnableErrorStack);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Default constructor
 /// </summary>
 internal FTPControlSocket(ILogTag logTag)
 {
     this.logTag = logTag;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Constructor. Performs TCP connection and
        /// sets up reader/writer. Allows different control
        /// port to be used
        /// </summary>
        /// <param name="remoteHost">
        /// Remote inet address
        /// </param>
        /// <param name="controlPort">
        /// port for control stream
        /// </param>
        /// <param name="timeout">
        /// the length of the timeout, in milliseconds
        /// </param>
        /// <param name="encoding">
        /// encoding to use for control channel
        /// </param>
        internal FTPControlSocket(string remoteHost, int controlPort, int timeout, Encoding encoding, ILogTag logTag)
            : this(logTag)
        {
            if (activePortRange != null)
            {
                activePortRange.ValidateRange();
            }

            Initialize(
                new StandardSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, logTag),
                remoteHost, controlPort, timeout, encoding);
        }
Ejemplo n.º 14
0
		public static void SetTag(ILogTag tag)
		{
			if (tag == null)
			{
				return;
			}
			lock (Logger.threadTags)
			{
				Logger.threadTags[Thread.CurrentThread.ManagedThreadId] = tag;
			}
		}
Ejemplo n.º 15
0
 /// <summary>   
 /// Default constructor
 /// </summary>
 internal FTPControlSocket(ILogTag logTag)
 {
     this.logTag = logTag;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the StandardSocket class
 /// </summary>
 public BaseSocket(
     AddressFamily addressFamily,
     SocketType socketType,
     ProtocolType protocolType,
     ILogTag logTag
     )
 {
     this.addressFamily = addressFamily;
     this.socketType = socketType;
     this.protocolType = protocolType;
     this.logTag = logTag;
 }
Ejemplo n.º 17
0
 public static void LogWarning(this ILogTag obj, string message)
 {
     message = GetLogText(GetLogTag(obj), GetLogCaller(), message);
     Internal_LogWarning(Prefix + message);
     LogToFile("[W]" + message);
 }
Ejemplo n.º 18
0
 public static void LogError(this ILogTag obj, string message)
 {
     message = GetLogText(GetLogTag(obj), GetLogCaller(), message);
     Internal_LogError(Prefix + message);
 }
Ejemplo n.º 19
0
	    /// <summary>
	    /// Initializes a new instance of the StandardSocket class
	    /// </summary>
 		public StandardSocket(
			AddressFamily addressFamily,
			SocketType socketType,
			ProtocolType protocolType,
            ILogTag logTag
            )
            : base(addressFamily, socketType, protocolType, logTag)
		{
			socket = new Socket(addressFamily, socketType, protocolType);
            socket.NoDelay = true;
            try
            {
                socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, SOCKET_BUFFER_SIZE);
                socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, SOCKET_BUFFER_SIZE);
            }
            catch (Exception ex)
            {
                log.Warn("Failed to set socket buffers: " + ex.Message);
            }
		}
Ejemplo n.º 20
0
        /// <summary>
        /// Constructor. Performs TCP connection and
        /// sets up reader/writer. Allows different control
        /// port to be used
        /// </summary>
        /// <param name="remoteHost">      
        /// Remote inet address
        /// </param>
        /// <param name="controlPort">     
        /// port for control stream
        /// </param>
        /// <param name="timeout">          
        /// the length of the timeout, in milliseconds
        /// </param>
        /// <param name="encoding">          
        /// encoding to use for control channel
        /// </param>
        internal FTPControlSocket(string remoteHost, int controlPort, int timeout, Encoding encoding, ILogTag logTag)
            : this(logTag)
        {
            if (activePortRange != null)
                activePortRange.ValidateRange();

            Initialize(
                new StandardSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, logTag),
                remoteHost, controlPort, timeout, encoding);
        }