当前位置: 首页>>代码示例>>C#>>正文


C# VLogger.Log方法代码示例

本文整理汇总了C#中VLogger.Log方法的典型用法代码示例。如果您正苦于以下问题:C# VLogger.Log方法的具体用法?C# VLogger.Log怎么用?C# VLogger.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VLogger的用法示例。


在下文中一共展示了VLogger.Log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HeartbeatService

        public HeartbeatService(Platform platform, VLogger log)
        {
            this.platform = platform;
            this.logger = log;
            this.tcb = SendHeartbeat;
            this.sequenceNumber = 0;
            try
            {
                this.uri = new Uri("https://" + GetHeartbeatServiceHostString() + ":" + Constants.HeartbeatServiceSecurePort + "/" +
                                   Constants.HeartbeatServiceWcfListenerEndPointUrlSuffix);
                this.heartbeatIntervalMins = Settings.HeartbeatIntervalMins;
                if (this.heartbeatIntervalMins < Constants.MinHeartbeatIntervalInMins)
                    this.heartbeatIntervalMins = Constants.MinHeartbeatIntervalInMins;
                if (this.heartbeatIntervalMins > Constants.MaxHeartbeatIntervalInMins)
                    this.heartbeatIntervalMins = Constants.MaxHeartbeatIntervalInMins;

                this.perfCountPercentProcTime = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName, true);
                this.perfCountWorkingSet = new PerformanceCounter("Process", "Working Set", Process.GetCurrentProcess().ProcessName, true);
            }
            catch (Exception e)
            {
                logger.Log("Platform failed failed to construct heartbeat service , Exception={0}", e.Message);
            }

        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:25,代码来源:HeartbeatService.cs

示例2: InfoService

        public InfoService (Platform platform, VLogger logger)
        {
            this.platform = platform;
            this.logger = logger;

            string homeIdPart = string.Empty;

            //if (HomeOS.Shared.Globals.HomeId != null)
            //{
            //    homeIdPart = "/" + HomeOS.Shared.Globals.HomeId;
            //}

            host = new ServiceHost(this, new Uri(HomeOS.Hub.Common.Constants.InfoServiceAddress + homeIdPart));
            host.AddServiceEndpoint(typeof(IHomeOSInfo), new WebHttpBinding(), "").Behaviors.Add(new System.ServiceModel.Description.WebHttpBehavior());
            
            var smb = new System.ServiceModel.Description.ServiceMetadataBehavior();
            smb.HttpGetEnabled = true;
            host.Description.Behaviors.Add(smb);

            try
            {
                host.Open();
            }
            catch (Exception e)
            {
                logger.Log("Could not open the service host: " + e.Message + @"
Possible issues: 1) are you running the command prompt / Visual Studio in administrator mode?      
                 2) is another instance of Platform running?
                 3) is a local copy of Gatekeeper running?
                 4) is another process occupying the InfoServicePort (51430)?");

                throw e;
            }
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:34,代码来源:InfoService.cs

示例3: Init

        public void Init(string baseUrl, string baseDir, ScoutViewOfPlatform platform, VLogger logger) {
            this.baseUrl = baseUrl;
            this.platform = platform;
            this.logger = logger;

            scoutService = new BluetoothScoutService(baseUrl + "/webapp", this, platform, logger);

            appServer = new WebFileServer(baseDir, baseUrl, logger);

            logger.Log("BluetoothScout initialized.");
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:11,代码来源:BluetoothScout.cs

示例4: Init

        public void Init(string baseUrl, string baseDir, ScoutViewOfPlatform platform, VLogger logger)
        {
            this.baseUrl = baseUrl;
            this.platform = platform;
            this.logger = logger;

            scoutService = new SynapseWirelessScoutService(baseUrl + "/webapp", this, logger);

            appServer = new WebFileServer(baseDir, baseUrl, logger);

            startSynapseController();

            logger.Log("SynapseWirelessScout initialized");
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:14,代码来源:SynapseWirelessScout.cs

示例5: Init

        public void Init(string baseUrl, string baseDir, ScoutViewOfPlatform platform, VLogger logger)
        {
            this.baseUrl = baseUrl;
            this.platform = platform;
            this.logger = logger;

            scoutService = new AxisCamScoutService(baseUrl + "/webapp", this, logger);

            appServer = new WebFileServer(baseDir, baseUrl, logger);

            logger.Log("AxisCamScout initialized");

            //create a time that fires ScanNow() periodically
            var scanTimer = new System.Timers.Timer(ScoutHelper.DefaultDeviceDiscoveryPeriodSec * 1000);
            scanTimer.Enabled = true;
            scanTimer.Elapsed += new System.Timers.ElapsedEventHandler(ScanNow);
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:17,代码来源:AxisCamScout.cs

示例6: Init

        public static void Init(VLogger loggerObject)
        {
            lock (lockObject)
            {
                if (instance != null)
                    loggerObject.Log("Duplicate Init called on ScoutHelper");

                instance = new object();
            }

            logger = loggerObject;

            //create a time that fires ScanNow() periodically
            upnpScanTimer = new Timer(ScoutHelper.DefaultDeviceDiscoveryPeriodSec * 1000);
            //upnpScanTimer = new Timer(1 * 1000);  // for debugging
            upnpScanTimer.Enabled = true;
            upnpScanTimer.Elapsed += new ElapsedEventHandler(UpnpScan);
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:18,代码来源:ScoutHelper.cs

示例7: Init

        public void Init(string baseUrl, string baseDir, ScoutViewOfPlatform platform, VLogger logger)
        {
            this.baseUrl = baseUrl;
            this.platform = platform;
            this.logger = logger;

            scoutService = new OwmScoutService(baseUrl + "/webapp", this, platform, logger);

            appServer = new WebFileServer(baseDir, baseUrl, logger);

            //initialize the device we'll use
            device = new Device("OpenWeatherMap", UniqueDeviceId(), "", DateTime.Now, "HomeOS.Hub.Drivers.OpenWeatherMap");

            // the parameters are: uniqueName, appid, lattitude, longitude
            device.Details.DriverParams = new List<string>() { device.UniqueName, DefaultAppId, "", "" };

            logger.Log("DummyScout initialized");
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:18,代码来源:OwmScout.cs

示例8: Init

        public void Init(string baseUrl, string baseDir, ScoutViewOfPlatform platform, VLogger logger)
        {
            this.baseUrl = baseUrl;
            this.platform = platform;
            this.logger = logger;

            scoutService = new ValveScoutService(baseUrl + "/webapp", this, platform, logger);

            appServer = new WebFileServer(baseDir, baseUrl, logger);

            //IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, listenPortNumber);
            //listenClient = new UdpClient(endpoint);

            //listenClient.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.PacketInformation, true);
            //listenClient.Client.BeginReceiveMessageFrom(asyncBuffer, 0, 2000, asyncSocketFlags, ref asyncRemoteEndPoint, new AsyncCallback(ReceiveCallback), null);

            //create a time that fires ScanNow() periodically
            var scanTimer = new Timer(ScoutHelper.DefaultDeviceDiscoveryPeriodSec * 1000);
            scanTimer.Enabled = true;
            scanTimer.Elapsed += new ElapsedEventHandler(ScanNow);

            logger.Log("ValveScout initialized");
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:23,代码来源:ValveScout.cs

示例9: BroadcastRequest

        public static bool BroadcastRequest(byte[] request, int portNumber, VLogger logger)
        {
            try
            {
                foreach (var netInterface in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (netInterface.OperationalStatus != OperationalStatus.Up)
                        continue;

                    foreach (var netAddress in netInterface.GetIPProperties().UnicastAddresses)
                    {
                        //only send to IPv4 and non-loopback addresses
                        if (netAddress.Address.AddressFamily != AddressFamily.InterNetwork ||
                            IPAddress.IsLoopback(netAddress.Address))
                            continue;

                        IPEndPoint localEp = new IPEndPoint(netAddress.Address, portNumber);
                        using (var client = new UdpClient(localEp))
                        {
                            //logger.Log("Sending bcast packet from {0}", localEp.ToString());
                            client.Client.EnableBroadcast = true;
                            var endPoint = new IPEndPoint(IPAddress.Broadcast, portNumber);
                            client.Connect(endPoint);
                            client.Send(request, request.Length);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.Log("Exception while sending UDP request. \n {0}", e.ToString());
                return false;
            }

            return true;
        }
开发者ID:smosgin,项目名称:labofthings,代码行数:36,代码来源:ScoutHelper.cs

示例10: HomeStoreInfo

        public HomeStoreInfo(VLogger logger)
        {
            this.logger = logger;

            RefreshDbs(null, null);

            if (Settings.HomeStoreRefreshIntervalsMins <= 0 ||
                Settings.HomeStoreRefreshIntervalsMins >= Int32.MaxValue / (60000))  //60000 = 60 * 1000 (secs) * (ms)
            {
                logger.Log("Illegal refresh value {0}. Must be >= 0 and < {1}", Settings.HomeStoreRefreshIntervalsMins.ToString(), (Int32.MaxValue / (60000)).ToString());
            }
            else
            {
                System.Timers.Timer refreshTimer = new System.Timers.Timer(Settings.HomeStoreRefreshIntervalsMins * 60000);
                //System.Timers.Timer refreshTimer = new System.Timers.Timer(10*1000);
                refreshTimer.Enabled = true;
                refreshTimer.Elapsed += RefreshDbs;
            }
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:19,代码来源:HomeStoreInfo.cs

示例11: GetHomeOSUpdateVersion

 public static string GetHomeOSUpdateVersion(string configFile, VLogger logger)
 {
     string homeosUpdateVersion = Constants.UnknownHomeOSUpdateVersionValue;
     try
     {
         XElement xmlTree = XElement.Load(configFile);
         IEnumerable<XElement> das =
             from el in xmlTree.DescendantsAndSelf()
             where el.Name == "add" && el.Parent.Name == "appSettings" && el.Attribute("key").Value == Constants.ConfigAppSettingKeyHomeOSUpdateVersion
             select el;
         if (das.Count() > 0)
         {
             homeosUpdateVersion = das.First().Attribute("value").Value;
         }
     }
     catch (Exception e)
     {
         if (e is DirectoryNotFoundException || e is FileNotFoundException)
         {
             if (logger != null)
                 logger.Log("Warning: File not found: " + configFile);
         }
         else
         {
             if (logger != null)
                 logger.Log(String.Format("GetHomeOSUpdateVersion call failed: Cannot parse {0}. {1}", configFile, "The vervsion is not returned"));
         }
     }
     return homeosUpdateVersion;
 }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:30,代码来源:Utils.cs

示例12: SendCloudEmail

        public static Tuple<bool, string> SendCloudEmail(string dst, string subject, string body, List<Attachment> attachmentList, VPlatform platform, VLogger logger)
        {
            string error = "";
            logger.Log("Utils.SendCloudEmail called with " + dst + " " + subject + " " + body);

            string smtpServer = platform.GetPrivateConfSetting("SmtpServer");
            string smtpUser = platform.GetPrivateConfSetting("SmtpUser");
            string smtpPassword = platform.GetPrivateConfSetting("SmtpPassword");
            Uri serviceHostUri = new Uri("https://" + platform.GetConfSetting("EmailServiceHost") + ":" + Shared.Constants.EmailServiceSecurePort + "/" +
                                   Shared.Constants.EmailServiceWcfEndPointUrlSuffix);

            string bodyLocal;

            CloudEmailer emailer = new CloudEmailer(serviceHostUri, smtpServer, smtpUser, smtpPassword, logger);

            if (string.IsNullOrWhiteSpace(body))
            {
                bodyLocal = platform.GetPrivateConfSetting("NotificationEmail");
            }
            else
            {
                bodyLocal = body;
            }

            Notification notification = BuildNotification(dst, subject, body, attachmentList);
            if (null == notification)
            {
                error = "Destination for the email not set";
                logger.Log(error);
                return new Tuple<bool, string>(false, error);
            }

            return emailer.Send(notification);
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:34,代码来源:Utils.cs

示例13: SendHubEmail

        /// <summary>
        /// Send email from Hub.
        /// </summary>
        /// <param name="dst">to:</param>
        /// <param name="subject">subject</param>
        /// <param name="body">body of the message</param>
        /// <returns>A tuple with true/false success and string exception message (if any)</returns>
        public static Tuple<bool, string> SendHubEmail(string dst, string subject, string body, List<Attachment> attachmentList, VPlatform platform, VLogger logger)
        {
            string error = "";
            logger.Log("Utils.SendHubEmail called with " + dst + " " + subject + " " + body);

            string smtpServer = platform.GetPrivateConfSetting("SmtpServer");
            string smtpUser = platform.GetPrivateConfSetting("SmtpUser");
            string smtpPassword = platform.GetPrivateConfSetting("SmtpPassword");
            string bodyLocal;

            Emailer emailer = new Emailer(smtpServer, smtpUser, smtpPassword, logger);

            if (string.IsNullOrWhiteSpace(body))
            {
                bodyLocal = platform.GetPrivateConfSetting("NotificationEmail");
            }
            else
            {
                bodyLocal = body;
            }

            Notification notification = BuildNotification(dst, subject, body, attachmentList);
            if (null == notification)
            {
                error = "Destination for the email not set";
                logger.Log(error);
                return new Tuple<bool, string>(false, error);
            }

            return emailer.Send(notification);
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:38,代码来源:Utils.cs

示例14: SendEmail

        /// <summary>
        /// Send email by trying to send from Hub first, if that fails, send using cloud relay.
        /// </summary>
        /// <param name="dst">to:</param>
        /// <param name="subject">subject</param>
        /// <param name="body">body of the message</param>
        /// <returns>A tuple with true/false success and string exception message (if any)</returns>
        public static Tuple<bool, string> SendEmail(string dst, string subject, string body, List<Attachment> attachmentList, VPlatform platform, VLogger logger)
        {
            logger.Log("Utils.SendEmail called with  " + dst + " " + subject + " " + body);

            Tuple<bool, string> result = SendHubEmail(dst, subject, body, attachmentList, platform, logger);
            if (!result.Item1)
            {
                logger.Log("SendHubEmail failed with error={0}", result.Item2);
                result = SendCloudEmail(dst, subject, body, attachmentList, platform, logger);
            }
            return result;
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:19,代码来源:Utils.cs

示例15: structuredLog

        public static void structuredLog(VLogger logger, string type, params string[] messages)
        {
            if (type == "ER") type = "ERROR";
            else if (type == "I") type = "INFO";
            else if (type == "E") type = "EXCEPTION";
            else if (type == "W") type = "WARNING";

            StringBuilder s = new StringBuilder();
            s.Append("[ConfigUpdater]" + "[" + type + "]");
            foreach (string message in messages)
                s.Append("[" + message + "]");
            logger.Log(s.ToString());
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:13,代码来源:Utils.cs


注:本文中的VLogger.Log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。