コード例 #1
0
        static int Main(string[] args)
        {
            string servicePath = Environment.GetEnvironmentVariable("CLOUD_TRACE_SERVICE_PATH");

            if (servicePath == null)
            {
                servicePath = ConfigurationManager.AppSettings["CloudTraceServicePath"];
            }

            string serviceNamespace = Environment.GetEnvironmentVariable("CLOUD_TRACE_SERVICE_NAMESPACE");

            if (serviceNamespace == null)
            {
                serviceNamespace = ConfigurationManager.AppSettings["CloudTraceServiceNamespace"];
            }

            string issuerName = Environment.GetEnvironmentVariable("CLOUD_TRACE_ISSUER_NAME");

            if (issuerName == null)
            {
                issuerName = ConfigurationManager.AppSettings["CloudTraceIssuerName"];
            }

            string issuerSecret = Environment.GetEnvironmentVariable("CLOUD_TRACE_ISSUER_SECRET");

            if (issuerSecret == null)
            {
                issuerSecret = ConfigurationManager.AppSettings["CloudTraceIssuerSecret"];
            }

            CloudTraceListener cloudTraceListener = new CloudTraceListener(servicePath, serviceNamespace, issuerName, issuerSecret);

            Program program = new Program(cloudTraceListener);

            string command   = "";
            string arguments = "";

            if (args.Length > 0)
            {
                command = args[0];
                if (args.Length > 1)
                {
                    arguments = args[1];
                }

                return(program.RunCommand(command, arguments));
            }
            else
            {
                PrintUsage();
                return(0);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string servicePath = Environment.GetEnvironmentVariable("CLOUD_TRACE_SERVICE_PATH");

            if (servicePath == null)
            {
                servicePath = ConfigurationManager.AppSettings["CloudTraceServicePath"];
            }

            string serviceNamespace = Environment.GetEnvironmentVariable("CLOUD_TRACE_SERVICE_NAMESPACE");

            if (serviceNamespace == null)
            {
                serviceNamespace = ConfigurationManager.AppSettings["CloudTraceServiceNamespace"];
            }

            string issuerName = Environment.GetEnvironmentVariable("CLOUD_TRACE_ISSUER_NAME");

            if (issuerName == null)
            {
                issuerName = ConfigurationManager.AppSettings["CloudTraceIssuerName"];
            }

            string issuerSecret = Environment.GetEnvironmentVariable("CLOUD_TRACE_ISSUER_SECRET");

            if (issuerSecret == null)
            {
                issuerSecret = ConfigurationManager.AppSettings["CloudTraceIssuerSecret"];
            }

            CloudTraceListener cloudTraceListener = new CloudTraceListener(servicePath, serviceNamespace, issuerName, issuerSecret);

            string message = args[0];

            cloudTraceListener.WriteLine(string.Format("{0}: {1:u} {2}", Environment.MachineName, DateTime.Now, message), "Information");
        }
コード例 #3
0
 private Program(CloudTraceListener cloudTraceListener)
 {
     this.cloudTraceListener = cloudTraceListener;
 }