internal static Pair <string, Redwood.Flag> GetSourceStringAndLevel(object[] channel)
        {
            // Parse the channels
            Type source = null;
            // The class the message is coming from
            object backupSource = null;

            // Another identifier for the message
            Redwood.Flag flag = Redwood.Flag.Stdout;
            if (channel != null)
            {
                foreach (object c in channel)
                {
                    if (c is Type)
                    {
                        source = (Type)c;
                    }
                    else
                    {
                        // This is a class the message is coming from
                        if (c is Redwood.Flag)
                        {
                            if (c != Redwood.Flag.Force)
                            {
                                // This is a Redwood flag
                                flag = (Redwood.Flag)c;
                            }
                        }
                        else
                        {
                            backupSource = c;
                        }
                    }
                }
            }
            // This is another "source" for the log message
            // Get the sourceString. Do at end because there is then an imposed priority ordering
            string sourceString;

            if (source != null)
            {
                sourceString = source.FullName;
            }
            else
            {
                if (backupSource != null)
                {
                    sourceString = backupSource.ToString();
                }
                else
                {
                    sourceString = "CoreNLP";
                }
            }
            return(new Pair <string, Redwood.Flag>(sourceString, flag));
        }
Exemplo n.º 2
0
 public RedwoodPrintStream(Redwood.Flag tag, TextWriter realStream)
     : base(realStream)
 {
     this.tag        = tag;
     this.realStream = realStream;
 }