コード例 #1
0
ファイル: logger.cs プロジェクト: elicec/springcard.pcsc.sdk
        public static void OpenSysLog(SysLog.Facility facility, string applicationName, string serverAddr, int serverPort = 514, bool useRfc5424 = false)
        {
            try {
                syslogFacility    = facility;
                syslogMachineName = Environment.MachineName;
                if (String.IsNullOrEmpty(applicationName))
                {
                    syslogApplicationName = System.AppDomain.CurrentDomain.FriendlyName;
                }
                else
                {
                    syslogApplicationName = applicationName;
                }

                syslogApplicationName += String.Format("[{0}]", Process.GetCurrentProcess().Id);

                if (useRfc5424)
                {
                    syslogSerializer = new SyslogRfc5424MessageSerializer();
                }
                else
                {
                    syslogSerializer = new SyslogRfc3164MessageSerializer();
                }
                syslogSender = new SyslogUdpSender(serverAddr, serverPort);
            } catch (Exception e) {
                syslogSender     = null;
                syslogSerializer = null;
                Log(Level.Warning, String.Format("Failed to create Syslog sender ({0})", e.Message));
            }
        }
コード例 #2
0
ファイル: logger.cs プロジェクト: elicec/springcard.pcsc.sdk
 public static void OpenSysLog(SysLog.Facility facility, string ServerAddr, int ServerPort = 514, bool useRfc5424 = false)
 {
     OpenSysLog(facility, null, ServerAddr, ServerPort, useRfc5424);
 }
コード例 #3
0
		public static void OpenSysLog(SysLog.Facility facility, string applicationName, string ServerAddr, int ServerPort = 514, bool useRfc5424 = false)
		{
            try
            {
                syslogFacility = facility;
                syslogMachineName = Environment.MachineName;
                if (String.IsNullOrEmpty(applicationName))
                    syslogApplicationName = System.AppDomain.CurrentDomain.FriendlyName;
                else
                    syslogApplicationName = applicationName;

                syslogApplicationName += String.Format("[{0}]", Process.GetCurrentProcess().Id);

                if (useRfc5424)
                    syslogSerializer = new SyslogRfc5424MessageSerializer();
                else
                    syslogSerializer = new SyslogRfc3164MessageSerializer();
                syslogSender = new SyslogUdpSender(ServerAddr, ServerPort);
            }
            catch
            {

            }            
		}
コード例 #4
0
 protected static int CalculatePriorityValue(SysLog.Facility facility, SysLog.Severity severity)
 {
     return(((int)facility * 8) + (int)severity);
 }