Example #1
0
        public static void Main(string[] args)
        {
            GVFSPlatformLoader.Initialize();

            using (JsonTracer tracer = new JsonTracer("Microsoft.Git.GVFS.Service.UI", "Service.UI"))
            {
                string error;
                string serviceUILogDirectory = GVFSPlatform.Instance.GetLogsDirectoryForGVFSComponent(GVFSConstants.Service.UIName);
                if (!GVFSPlatform.Instance.FileSystem.TryCreateDirectoryWithAdminAndUserModifyPermissions(serviceUILogDirectory, out error))
                {
                    EventMetadata metadata = new EventMetadata();
                    metadata.Add(nameof(serviceUILogDirectory), serviceUILogDirectory);
                    metadata.Add(nameof(error), error);
                    tracer.RelatedWarning(
                        metadata,
                        "Failed to create service UI logs directory",
                        Keywords.Telemetry);
                }
                else
                {
                    string logFilePath = GVFSEnlistment.GetNewGVFSLogFileName(
                        serviceUILogDirectory,
                        GVFSConstants.LogFileTypes.ServiceUI,
                        logId: Environment.UserName);

                    tracer.AddLogFileEventListener(logFilePath, EventLevel.Informational, Keywords.Any);
                }

                WinToastNotifier        winToastNotifier    = new WinToastNotifier(tracer);
                GVFSToastRequestHandler toastRequestHandler = new GVFSToastRequestHandler(winToastNotifier, tracer);
                GVFSServiceUI           process             = new GVFSServiceUI(tracer, toastRequestHandler);

                process.Start(args);
            }
        }
Example #2
0
        public static void Main(string[] args)
        {
            using (JsonEtwTracer tracer = new JsonEtwTracer("Microsoft.Git.GVFS.Service.UI", "Service.UI"))
            {
                string logLocation = Path.Combine(
                    Environment.GetEnvironmentVariable("LocalAppData"),
                    GVFSConstants.Service.UIName,
                    "serviceUI.log");

                tracer.AddLogFileEventListener(logLocation, EventLevel.Informational, Keywords.Any);
                GVFSServiceUI process = new GVFSServiceUI(tracer);
                process.Start(args);
            }
        }