public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Move EventLogger to frysk-gui directory (where it is still used).
@ 2008-02-29 20:01 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-02-29 20:01 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  b69a9d32535ea10a98fb4f67ef0778073654ea58 (commit)
       via  0fe9200a05186a2605f7d9984ea54186ff70e34d (commit)
      from  341be145d54d20251fb1106604c64189d8d45f65 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit b69a9d32535ea10a98fb4f67ef0778073654ea58
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Feb 29 14:59:08 2008 -0500

    Move EventLogger to frysk-gui directory (where it is still used).
    
    frysk-core/frysk/bindir/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* TestFcore.java: Update option tests to match options.
    
    frysk-core/frysk/util/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* CommandlineParser.java: Replace EventLogger with LogOption.
    
    frysk-gui/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* frysk/EventLogger.java: Move from frysk-sys/frysk/.
    
    frysk-sys/frysk/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* EventLogger.java: Move to frysk-gui/frysk.
    
    frysk-sys/frysk/junit/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* Runner.java (logger): Delete.
    	(-l, -log): Delete.
    	(-c): Call LogOption.parse(String).
    
    frysk-sys/frysk/rsl/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* LogOption.java (parse(String)): Rename level(String).
    	(parse(Node,String)): Rename level(Node,String).
    	(LogOption(String,char)): New.
    	* TestOptions.java: Update.

commit 0fe9200a05186a2605f7d9984ea54186ff70e34d
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri Feb 29 11:42:59 2008 -0500

    Delete compat code from rsl.
    
    frysk-sys/frysk/rsl/ChangeLog
    2008-02-29  Andrew Cagney  <cagney@redhat.com>
    
    	* Logger.java: Delete.
    	* Log.java (format(String,Object[])): Delete.
    	(format(String,Object)): Delete.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/bindir/ChangeLog               |    2 +
 frysk-core/frysk/bindir/TestFcore.java          |   44 +++-------------
 frysk-core/frysk/util/ChangeLog                 |    2 +
 frysk-core/frysk/util/CommandlineParser.java    |    7 +--
 frysk-gui/ChangeLog                             |    4 ++
 {frysk-sys => frysk-gui}/frysk/EventLogger.java |    0 
 frysk-sys/frysk/ChangeLog                       |    4 ++
 frysk-sys/frysk/junit/ChangeLog                 |    6 ++
 frysk-sys/frysk/junit/Runner.java               |   43 ++--------------
 frysk-sys/frysk/rsl/ChangeLog                   |   11 ++++
 frysk-sys/frysk/rsl/Log.java                    |   22 --------
 frysk-sys/frysk/rsl/LogOption.java              |   29 ++++++++--
 frysk-sys/frysk/rsl/Logger.java                 |   64 -----------------------
 frysk-sys/frysk/rsl/TestOptions.java            |    2 +-
 14 files changed, 67 insertions(+), 173 deletions(-)
 rename {frysk-sys => frysk-gui}/frysk/EventLogger.java (100%)
 delete mode 100644 frysk-sys/frysk/rsl/Logger.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/bindir/ChangeLog b/frysk-core/frysk/bindir/ChangeLog
index 70362ce..51931f1 100644
--- a/frysk-core/frysk/bindir/ChangeLog
+++ b/frysk-core/frysk/bindir/ChangeLog
@@ -25,6 +25,8 @@
 
 2008-02-29  Andrew Cagney  <cagney@redhat.com>
 
+	* TestFcore.java: Update option tests to match options.
+
 	* ftrace.java: Glob moved to frysk.util.Glob.
 
 2008-02-29  Sami Wagiaalla  <swagiaal@redhat.com>
diff --git a/frysk-core/frysk/bindir/TestFcore.java b/frysk-core/frysk/bindir/TestFcore.java
index 64e9d4c..4189bb7 100644
--- a/frysk-core/frysk/bindir/TestFcore.java
+++ b/frysk-core/frysk/bindir/TestFcore.java
@@ -57,52 +57,22 @@ public class TestFcore extends TestLib {
 	e.expect("Error: ");
     }
 
-    public void testBadConsoleParameter () {
+    public void testBadDebugParameter () {
 	TearDownExpect e = new TearDownExpect(new String[] {
 		Config.getBinFile("fcore").getAbsolutePath (),
-		"-console", "frysk=SILLY",
+		"-debug", "frysk=SILLY",
 		"1"
 	    });
-	e.expect("fcore: Invalid log console: SILLY");
+	e.expect("fcore: Invalid log level: frysk=SILLY");
     }
 
-    public void testBadLogParameter () {
+    public void testGoodDebugParameter () {
 	TearDownExpect e = new TearDownExpect(new String[] {
 		Config.getBinFile("fcore").getAbsolutePath (),
-		"-log", "frysk=SILLY",
-		"1"
-	    });
-	e.expect("fcore: Invalid log level: SILLY");
-    }
-
-    public void testGoodConsoleBadLogParameter () {
-	TearDownExpect e = new TearDownExpect(new String[] {
-		Config.getBinFile("fcore").getAbsolutePath (),
-		"-console", "frysk=FINE",
-		"-log", "frysk=SILLY",
-		"1"
-	    });
-	e.expect ("fcore: Invalid log level: SILLY");
-    }
-
-    public void testBadConsoleBadLogParameter () {
-	TearDownExpect e = new TearDownExpect(new String[] {
-		Config.getBinFile("fcore").getAbsolutePath (),
-		"-console", "frysk=SILLY",
-		"-log", "frysk=SILLY",
-		"1"
-	    });
-	e.expect("fcore: Invalid log console: SILLY");
-    }
-
-    public void testBadConsoleGoodLogParameter () {
-	TearDownExpect e = new TearDownExpect(new String[] {
-		Config.getBinFile("fcore").getAbsolutePath (),
-		"-console", "frysk=SILLY",
-		"-log", "frysk=FINE",
-		"1"
+		"-debug", "frysk=FINE",
+		"no-such-file"
 	    });
-	e.expect("fcore: Invalid log console: SILLY");
+	e.expect("Error: open: No such file or directory");
     }
 
     public void testInvalidArgument () {
diff --git a/frysk-core/frysk/util/ChangeLog b/frysk-core/frysk/util/ChangeLog
index ba686d2..ad11190 100644
--- a/frysk-core/frysk/util/ChangeLog
+++ b/frysk-core/frysk/util/ChangeLog
@@ -4,6 +4,8 @@
 
 2008-02-29  Andrew Cagney  <cagney@redhat.com>
 
+	* CommandlineParser.java: Replace EventLogger with LogOption.
+
 	* Glob.java: Extracted from frysk.bindir.ftrace.
 
 2008-02-28  Sami Wagiaalla  <swagiaal@redhat.com>
diff --git a/frysk-core/frysk/util/CommandlineParser.java b/frysk-core/frysk/util/CommandlineParser.java
index 03347ec..7d005ae 100644
--- a/frysk-core/frysk/util/CommandlineParser.java
+++ b/frysk-core/frysk/util/CommandlineParser.java
@@ -48,7 +48,7 @@ import gnu.classpath.tools.getopt.Option;
 import gnu.classpath.tools.getopt.OptionException;
 import gnu.classpath.tools.getopt.Parser;
 import frysk.Config;
-import frysk.EventLogger;
+import frysk.rsl.LogOption;
 import frysk.rsl.Log;
 import frysk.proc.dead.LinuxCoreFactory;
 import frysk.proc.dead.LinuxExeFactory;
@@ -56,8 +56,7 @@ import frysk.proc.Proc;
 
 /**
  * CommandlineParser extends the getopt {@link Parser} class with
- * common options for Frysk command-line applications. It adds the
- * {@link EventLogger} options.
+ * common options for Frysk command-line applications.
  */
 public class CommandlineParser {
     private final Log fine = Log.fine(CommandlineParser.class);
@@ -66,7 +65,7 @@ public class CommandlineParser {
 
     public CommandlineParser(String name, String version) {
 	parser = new Parser(name, version, true);
-	EventLogger.addConsoleOptions(parser);
+	parser.add(new LogOption("debug"));
 	add(new Option("noexe", "Do not attempt to read an"+
 		       " executable for a corefile ") {
 		public void parsed(String exeValue) throws OptionException {
diff --git a/frysk-gui/ChangeLog b/frysk-gui/ChangeLog
index cb1dec3..9a317da 100644
--- a/frysk-gui/ChangeLog
+++ b/frysk-gui/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-29  Andrew Cagney  <cagney@redhat.com>
+
+	* frysk/EventLogger.java: Move from frysk-sys/frysk/.
+
 2007-12-03  Andrew Cagney  <cagney@redhat.com>
 
 	* Makefile.am (GEN_CLASSPATH): Add frysk-sys.jar, frysk-core.jar,
diff --git a/frysk-sys/frysk/EventLogger.java b/frysk-gui/frysk/EventLogger.java
similarity index 100%
rename from frysk-sys/frysk/EventLogger.java
rename to frysk-gui/frysk/EventLogger.java
diff --git a/frysk-sys/frysk/ChangeLog b/frysk-sys/frysk/ChangeLog
index 5ce808c..e2a9939 100644
--- a/frysk-sys/frysk/ChangeLog
+++ b/frysk-sys/frysk/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-29  Andrew Cagney  <cagney@redhat.com>
+
+	* EventLogger.java: Move to frysk-gui/frysk.
+
 2008-02-11  Andrew Cagney  <cagney@redhat.com>
 
 	* EventLogger.java: Rename LogOption to "debug".
diff --git a/frysk-sys/frysk/junit/ChangeLog b/frysk-sys/frysk/junit/ChangeLog
index 5965004..3269712 100644
--- a/frysk-sys/frysk/junit/ChangeLog
+++ b/frysk-sys/frysk/junit/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-29  Andrew Cagney  <cagney@redhat.com>
+
+	* Runner.java (logger): Delete.
+	(-l, -log): Delete.
+	(-c): Call LogOption.parse(String).
+
 2008-02-19  Nurdin Premji  <npremji@redhat.com>
 
 	* TestCase.java (unresolvedCompilerNoSupportForAT_INTERFACE): Added.
diff --git a/frysk-sys/frysk/junit/Runner.java b/frysk-sys/frysk/junit/Runner.java
index 6337e74..109fd3e 100755
--- a/frysk-sys/frysk/junit/Runner.java
+++ b/frysk-sys/frysk/junit/Runner.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2005, 2006, 2007, Red Hat Inc.
+// Copyright 2005, 2006, 2007, 2008, Red Hat Inc.
 //
 // FRYSK is free software; you can redistribute it and/or modify it
 // under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@
 package frysk.junit;
 
 import frysk.Config;
-import frysk.EventLogger;
+import frysk.rsl.LogOption;
 import frysk.expunit.Expect;
 import gnu.classpath.tools.getopt.FileArgumentCallback;
 import gnu.classpath.tools.getopt.Option;
@@ -51,9 +51,6 @@ import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.LinkedList;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
 import java.util.regex.PatternSyntaxException;
 import junit.framework.Test;
 import junit.framework.TestResult;
@@ -64,11 +61,7 @@ import junit.textui.TestRunner;
  * <em>frysk</em> specific extension to the JUnit test framework.
  */
 
-public class Runner
-    extends TestRunner
-{
-    static final Logger logger = Logger.getLogger("frysk");
-    
+public class Runner extends TestRunner {
     // Repeat once by default.
     private int repeatValue = 1;
     private Collection testCases = null;
@@ -221,42 +214,14 @@ public class Runner
     private Parser createCommandLineParser (String programName) {
 	Parser parser = new Parser (programName, "1.0", true);
 	
-	EventLogger.addConsoleOptions(parser);
+	parser.add(new LogOption("debug", 'c'));
 	
 	parser.add(new Option("unbreak", 'u', "Run broken tests") {
 		public void parsed (String arg) throws OptionException {
 		    skipUnresolvedTests = false;
 		}
 	    });
-    
-	parser.add(new Option('c', "Shortcut for --console frysk=LEVEL.",
-			      "<LEVEL>") {
-		public void parsed (String arg0) throws OptionException {
-		    Logger logger = LogManager.getLogManager()
-			.getLogger("frysk");
-		    try {
-			Level consoleLevel = Level.parse(arg0);
-			EventLogger.setConsoleLog(logger, consoleLevel);
-			
-		    } catch (IllegalArgumentException e) {
-			throw new OptionException("Invalid log console: " + arg0);
-		    }
-		}
-	    });
 		
-	parser.add(new Option('l', "Shortcut for --log frysk=LEVEL",
-			      "<LEVEL>") {
-		public void parsed (String arg0) throws OptionException {
-		    Logger logger = LogManager.getLogManager()
-			.getLogger("frysk");
-		    try {
-			Level level = Level.parse(arg0);
-			logger.setLevel(level);
-		    } catch (IllegalArgumentException e) {
-			throw new OptionException ("Invalid log console: " + arg0);
-		    }
-		}
-	    });
 	// Determine the number of times that the testsuite should be
 	// run.
 	parser.add (new Option ("repeat",  'r',
diff --git a/frysk-sys/frysk/rsl/ChangeLog b/frysk-sys/frysk/rsl/ChangeLog
index 260b750..5ce579b 100644
--- a/frysk-sys/frysk/rsl/ChangeLog
+++ b/frysk-sys/frysk/rsl/ChangeLog
@@ -1,3 +1,14 @@
+2008-02-29  Andrew Cagney  <cagney@redhat.com>
+
+	* LogOption.java (parse(String)): Rename level(String).
+	(parse(Node,String)): Rename level(Node,String).
+	(LogOption(String,char)): New.
+	* TestOptions.java: Update.
+
+	* Logger.java: Delete.
+	* Log.java (format(String,Object[])): Delete.
+	(format(String,Object)): Delete.
+
 2008-02-28  Andrew Cagney  <cagney@redhat.com>
 
 	* Log.java: Add more loggers.
diff --git a/frysk-sys/frysk/rsl/Log.java b/frysk-sys/frysk/rsl/Log.java
index ea69908..306d6e0 100644
--- a/frysk-sys/frysk/rsl/Log.java
+++ b/frysk-sys/frysk/rsl/Log.java
@@ -43,7 +43,6 @@ import frysk.sys.Tid;
 import frysk.sys.Pid;
 import inua.util.PrintWriter;
 import java.io.PrintStream;
-import java.text.MessageFormat;
 import java.lang.reflect.Array;
 
 /**
@@ -349,27 +348,6 @@ public final class Log {
 	return this;
     }
     
-    /**
-     * For compatibility with existing loggers.
-     */
-    public void format(String msg, Object[] o) {
-	if (!logging)
-	    return;
-	prefix();
-	print(MessageFormat.format(msg, o));
-	suffix();
-    }
-    /**
-     * For compatibility with existing loggers.
-     */
-    public void format(String msg, Object o) {
-	if (!logging)
-	    return;
-	prefix();
-	print(MessageFormat.format(msg, new Object[] { o }));
-	suffix();
-    }
-
     // static 1 parameter
     public void log(String p1) {
 	if (!logging)
diff --git a/frysk-sys/frysk/rsl/LogOption.java b/frysk-sys/frysk/rsl/LogOption.java
index 6b35e07..3f18fe4 100644
--- a/frysk-sys/frysk/rsl/LogOption.java
+++ b/frysk-sys/frysk/rsl/LogOption.java
@@ -47,6 +47,9 @@ import java.io.FileOutputStream;
 
 public class LogOption extends Option {
 
+    /**
+     * Create a logger option, with NAME as the long flag.
+     */
     public LogOption(String name) {
 	super(name,
 	      ("Set debug-tracing of COMP to LEVEL.\n"
@@ -54,19 +57,33 @@ public class LogOption extends Option {
 	       + "Example: " + name + " frysk.rsl=FINE"),
 	      "<COMP=LEVEL,...>");
     }
+    /**
+     * Create a log option, with NAME as the long parameter, and C
+     * as the character flag.
+     */
+    public LogOption(String name, char c) {
+	super(name, c,
+	      ("Set debug-tracing of COMP to LEVEL.\n"
+	       + "LEVEL can be [ NONE | FINE | FINEST ]; default is FINE.\n"
+	       + "Example: " + name + " frysk.rsl=FINE"),
+	      "<COMP=LEVEL,...>");
+    }
+    /**
+     * Called by option parser; handle option with specified argument.
+     */
     public void parsed (String arg0) throws OptionException {
-	level(arg0);
+	parse(arg0);
     }
     /**
      * Parse ARG0 setting log levels.
      */
-    public static void level(String arg0) throws OptionException {
-	level(LogFactory.root, arg0);
+    public static void parse(String arg0) throws OptionException {
+	parse(LogFactory.root, arg0);
     }
     /**
      * Parse ARG0 setting log levels.
      */
-    static void level(Node root, String arg0) throws OptionException {
+    static void parse(Node root, String arg0) throws OptionException {
 	String[] logs = arg0.split(",");
 	for (int i = 0; i < logs.length; i++) {
 	    String[] logLevel = logs[i].split("=");
@@ -92,10 +109,10 @@ public class LogOption extends Option {
 		throw new OptionException("Could not parse: " + logs[i]);
 	    }
 	    if (logger == null)
-		throw new OptionException("Couldn't find logger for: "
+		throw new OptionException("Could not find logger: "
 					  + logs[i]);
 	    if (level == null)
-		throw new OptionException("Invalid log level for: "
+		throw new OptionException("Invalid log level: "
 					  + logs[i]);
 	    logger.set(level);
 	}
diff --git a/frysk-sys/frysk/rsl/Logger.java b/frysk-sys/frysk/rsl/Logger.java
deleted file mode 100644
index e498cb8..0000000
--- a/frysk-sys/frysk/rsl/Logger.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// This file is part of the program FRYSK.
-// 
-// Copyright 2007, Red Hat Inc.
-// 
-// FRYSK is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-// 
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.rsl;
-
-/**
- * Java logger compatibility class; to aid easy conversion.
- */
-public final class Logger {
-    public static Logger getLogger(String path) {
-	return new Logger(path);
-    }
-    private final Log[] logger = new Log[Level.MAX.intValue()];
-    private Logger(String path) {
-	for (int i = 0; i < Level.MAX.intValue(); i++) {
-	    this.logger[i] = LogFactory.get(path).get(Level.valueOf(i));
-	}
-    }
-    public boolean isLoggable(Level level) {
-	return logger[level.intValue()].logging();
-    }
-    public void log(Level level, String message, Object[] param) {
-	logger[level.intValue()].format(message, param);
-    }
-    public void log(Level level, String message, Object param) {
-	logger[level.intValue()].format(message, param);
-    }
-}
diff --git a/frysk-sys/frysk/rsl/TestOptions.java b/frysk-sys/frysk/rsl/TestOptions.java
index 36756ed..478eac7 100644
--- a/frysk-sys/frysk/rsl/TestOptions.java
+++ b/frysk-sys/frysk/rsl/TestOptions.java
@@ -48,7 +48,7 @@ import gnu.classpath.tools.getopt.OptionException;
 public class TestOptions extends TestLib {
     private void parse(String option) {
 	try {
-	    LogOption.level(get(""), option);
+	    LogOption.parse(get(""), option);
 	} catch (OptionException e) {
 	    fail(e.getMessage());
 	}


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-29 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-29 20:01 [SCM] master: Move EventLogger to frysk-gui directory (where it is still used) cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).