enableLogging() 공개 정적인 메소드

Enable logging.
/// The file name contains invalid characters. ///
public static enableLogging ( MamaLogLevel level ) : void
level MamaLogLevel /// The logging level allowed. ///
리턴 void
예제 #1
0
        private bool parseCommandLine(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].CompareTo("-s") == 0)
                {
                    if ((i + 1) < args.Length)
                    {
                        topicName = args[++i];
                        continue;
                    }
                }

                if (args[i].CompareTo("-m") == 0)
                {
                    if ((i + 1) < args.Length)
                    {
                        middlewareNames.Add(args[++i]);
                        continue;
                    }
                }

                if (args[i].CompareTo("-tport") == 0)
                {
                    if ((i + 1) < args.Length)
                    {
                        transportName = args[++i];
                        continue;
                    }
                }

                if (args[i].CompareTo("--help") == 0)
                {
                    Console.WriteLine(usage);
                    return(false);
                }

                if (args[i].CompareTo("-?") == 0)
                {
                    Console.WriteLine(usage);
                    return(false);
                }

                if (args[i].CompareTo("-v") == 0)
                {
                    if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    continue;
                }

                Console.WriteLine("Error: unrecognized parameter: " + args[i]);
                return(false);
            }

            return(true);
        }
예제 #2
0
        private void ParseArgs()
        {
            for (int i = 0; i < args.Length;)
            {
                string arg = args[i];
                if (arg[0] != '-')
                {
                    Console.WriteLine("Ignoring invalid argument {0}", arg);
                    ++i;
                    continue;
                }
                string opt = arg.Substring(1);
                switch (opt)
                {
                case "m":
                case "middleware":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting name after {0}", arg);
                        ++i;
                        continue;
                    }
                    middleware = args[++i];
                    break;

                case "p":
                case "port":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting port after {0}", arg);
                        ++i;
                        continue;
                    }
                    try
                    {
                        port = int.Parse(args[++i], NumberStyles.Integer, CultureInfo.InvariantCulture);
                    }
                    catch                             // ignore parse error
                    {
                    }
                    break;

                case "h":
                case "?":
                    helpNeeded = true;
                    return;

                case "q":
                    quiet = true;
                    break;

                case "v":
                    if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
                        Mama.enableLogging(logLevel);
                    }
                    else if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
                        Mama.enableLogging(logLevel);
                    }
                    else if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
                        Mama.enableLogging(logLevel);
                    }
                    else
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
                        Mama.enableLogging(logLevel);
                    }
                    break;

                default:
                    Console.WriteLine("Ignoring invalid option {0}", arg);
                    break;
                }
                ++i;
            }

            if (!quiet)
            {
                Console.WriteLine("Starting IO with:\n" +
                                  "   port:               {0}", port);
            }
        }
예제 #3
0
        private void parseCommandLine(string[] args)
        {
            string tport          = null;
            uint   ft_type        = (uint)mamaFtType.MAMA_FT_TYPE_MULTICAST;
            bool   displayVersion = false;

            for (int i = 0; i < args.Length;)
            {
                if ((args[i].CompareTo("-h")) == 0 ||
                    (args[i].CompareTo("-?")) == 0)
                {
                    usage(0);
                }

                if ((args[i].CompareTo("-g") == 0) ||
                    (args[i].CompareTo("-group") == 0))
                {
                    myGroup = args[i + 1];
                    i      += 2;
                    continue;
                }

                if ((args[i].CompareTo("-w") == 0) ||
                    (args[i].CompareTo("-weight") == 0))
                {
                    myWeight = Convert.ToUInt32(args[i + 1]);
                    i       += 2;
                    continue;
                }

                if (args[i].CompareTo("-m") == 0)
                {
                    myMiddleware = args[i + 1];
                    i           += 2;
                    continue;
                }

                if ((args[i].CompareTo("-t") == 0) ||
                    (args[i].CompareTo("-tport") == 0))
                {
                    tport = args[i + 1];
                    i    += 2;
                    continue;
                }

                if (args[i].CompareTo("-v") == 0)
                {
                    if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    i++;
                    continue;
                }

                if (args[i].CompareTo("-version") == 0)
                {
                    displayVersion = true;
                    break;
                }

                if (args[i].CompareTo("-b") == 0)
                {
                    ft_type = (uint)mamaFtType.MAMA_FT_TYPE_BRIDGE;
                    i++;
                    continue;
                }

                i++;
            }

            myBridge = Mama.loadBridge(myMiddleware);

            Mama.open();

            if (displayVersion)
            {
                Console.WriteLine(Mama.getVersion(myBridge));
                Exit(0);
            }

            myTimer = new MamaTimer();

            myTransport = new MamaTransport();
            myTransport.create(tport, myBridge);

            if (myGroup == null)
            {
                Console.WriteLine("No FT group name specified");
                usage(1);
            }

            switch (ft_type)
            {
            case (uint)mamaFtType.MAMA_FT_TYPE_MULTICAST:
                myFtMember = new MamaMulticastFtMember();
                break;

            case (uint)mamaFtType.MAMA_FT_TYPE_BRIDGE:
                myFtMember = new MamaBridgeFtMember();
                break;

            default:
                Console.WriteLine("No FT type specified");
                usage(1);
                break;
            }
        }
예제 #4
0
        private void ParseArgs()
        {
            for (int i = 0; i < args.Length;)
            {
                string arg = args[i];
                if (arg[0] != '-')
                {
                    Console.WriteLine("Ignoring invalid argument {0}", arg);
                    ++i;
                    continue;
                }
                string opt = arg.Substring(1);
                switch (opt)
                {
                case "s":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting outbound topic name after {0}", arg);
                        ++i;
                        continue;
                    }
                    outboundTopic = args[++i];
                    break;

                case "l":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting inbound topic name after {0}", arg);
                        ++i;
                        continue;
                    }
                    inboundTopic = args[++i];
                    break;

                case "nosub":
                    nosub = true;
                    break;

                case "c":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting message count after {0}", arg);
                        ++i;
                        continue;
                    }
                    try
                    {
                        messageCount = int.Parse(args[++i], NumberStyles.Integer, CultureInfo.InvariantCulture);
                    }
                    catch     // ignore parse error
                    {
                    }
                    break;

                case "i":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting interval after {0}", arg);
                        ++i;
                        continue;
                    }
                    double.TryParse(args[++i], NumberStyles.Float, CultureInfo.InvariantCulture, out interval);
                    break;

                case "h":
                case "?":
                    helpNeeded = true;
                    return;

                case "m":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expected middleware name after {0}", arg);
                        ++i;
                        continue;
                    }
                    middlewareName = args[++i];
                    break;

                case "tport":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting transport name after {0}", arg);
                        ++i;
                        continue;
                    }
                    transportName = args[++i];
                    break;

                case "q":
                    quiet = true;
                    break;

                case "pubCb":
                    pubCb = true;
                    break;

                case "v":
                    if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
                        Mama.enableLogging(logLevel);
                    }
                    else if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
                        Mama.enableLogging(logLevel);
                    }
                    else if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
                        Mama.enableLogging(logLevel);
                    }
                    else
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
                        Mama.enableLogging(logLevel);
                    }
                    break;

                default:
                    Console.WriteLine("Ignoring invalid option {0}", arg);
                    break;
                }
                ++i;
            }

            Console.WriteLine("Starting Publisher with:\n" +
                              "   topic:              {0}\n" +
                              "   inbound topic:      {1}\n" +
                              "   interval            {2}\n" +
                              "   middleware          {3}\n" +
                              "   transport:          {4}\n",
                              outboundTopic, inboundTopic, interval, middlewareName, transportName);
        }
예제 #5
0
        private void ParseArgs()
        {
            for (int i = 0; i < args.Length;)
            {
                string arg = args[i];
                if (arg[0] != '-')
                {
                    Console.WriteLine("Ignoring invalid argument {0}", arg);
                    ++i;
                    continue;
                }
                string opt = arg.Substring(1);
                switch (opt)
                {
                case "s":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting inbound topic name after {0}", arg);
                        ++i;
                        continue;
                    }
                    inboundTopic = args[++i];
                    break;

                case "h":
                case "?":
                    helpNeeded = true;
                    return;

                case "m":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting middleware name after {0}", arg);
                        ++i;
                        continue;
                    }
                    middlewareName = args[++i];
                    break;

                case "tport":
                    if ((i + 1) == args.Length)
                    {
                        Console.WriteLine("Expecting transport name after {0}", arg);
                        ++i;
                        continue;
                    }
                    transportName = args[++i];
                    break;

                case "q":
                    quiet = true;
                    break;

                case "v":
                    if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
                        Mama.enableLogging(logLevel);
                    }
                    else if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
                        Mama.enableLogging(logLevel);
                    }
                    else if (logLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
                        Mama.enableLogging(logLevel);
                    }
                    else
                    {
                        logLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
                        Mama.enableLogging(logLevel);
                    }
                    break;

                default:
                    Console.WriteLine("Ignoring invalid option {0}", arg);
                    break;
                }
                ++i;
            }

            if (!quiet)
            {
                Console.WriteLine("Starting Publisher with:\n" +
                                  "   topic:              {0}\n" +
                                  "   transport:          {1}\n",
                                  inboundTopic,
                                  transportName);
            }
        }