Commit 63a15582 authored by Dominique Marcadet's avatar Dominique Marcadet

Merge branch '17-add-a-verbose-level-in-console' into 'master'

Resolve "add a verbose level in console"

Closes #17

See merge request RiseClipseGroup/RiseClipseMain!19
parents fab57e22 379850e1
......@@ -64,11 +64,11 @@ public abstract class AbstractRiseClipseConsole implements IRiseClipseConsole {
/**
* Constructs a new console, using it as the unique one
* (the previous one, if any, is forgotten).
* The initial level is set to {@link IRiseClipseConsole#INFO_LEVEL}
* The initial level is set to {@link IRiseClipseConsole#WARNING_LEVEL}
*/
protected AbstractRiseClipseConsole() {
console = this;
currentLevel = INFO_LEVEL;
currentLevel = WARNING_LEVEL;
}
/**
......@@ -76,15 +76,25 @@ public abstract class AbstractRiseClipseConsole implements IRiseClipseConsole {
*/
public int setLevel( int level ) {
int previousLevel = currentLevel;
if(( level >= INFO_LEVEL ) && ( level <= FATAL_LEVEL )) {
if(( level >= VERBOSE_LEVEL ) && ( level <= FATAL_LEVEL )) {
currentLevel = level;
}
return previousLevel;
}
/**
* Prefixes message with VERBOSE and delegates to {@link AbstractRiseClipseConsole#doOutputMessage(String)}
* if current level is {@link #VERBOSE_LEVEL}
*/
public final void verbose( Object o ) {
if( currentLevel <= VERBOSE_LEVEL ) {
doOutputMessage( "VERBOSE: " + o.toString() );
}
}
/**
* Prefixes message with INFO and delegates to {@link AbstractRiseClipseConsole#doOutputMessage(String)}
* if current level is {@link #INFO_LEVEL}
* if current level is {@link #INFO_LEVEL} or below
*/
public final void info( Object o ) {
if( currentLevel <= INFO_LEVEL ) {
......
......@@ -28,22 +28,30 @@ package fr.centralesupelec.edf.riseclipse.util;
*/
public interface IRiseClipseConsole {
public final static int INFO_LEVEL = 1;
public final static int WARNING_LEVEL = 2;
public final static int ERROR_LEVEL = 3;
public final static int FATAL_LEVEL = 4;
public final static int VERBOSE_LEVEL = 1;
public final static int INFO_LEVEL = 2;
public final static int WARNING_LEVEL = 3;
public final static int ERROR_LEVEL = 4;
public final static int FATAL_LEVEL = 5;
/**
* Set the current level of displayed messages.
*
* @param level minimal level of messages to be displayed,
* ignored if outside [INFO_LEVEL..FATAL_LEVEL]
* ignored if outside [VERBOSE_LEVEL..FATAL_LEVEL]
* @return the previous level
*/
public int setLevel( int level );
/**
* Output message o.toString() if current level is VERBOSE_LEVEL
*
* @param o message to be displayed
*/
public void verbose( Object o );
/**
* Output message o.toString() if current level is INFO_LEVEL
* Output message o.toString() if current level is INFO_LEVEL or below
*
* @param o message to be displayed
*/
......
......@@ -58,7 +58,7 @@ public abstract class RiseClipseModelLoader {
}
public Resource load( String name ) {
console.info( "Loading: " + name );
console.verbose( "Loading file " + name + " in RiseCliupse" );
int currentSize = resourceSet.getResources().size();
......@@ -74,6 +74,7 @@ public abstract class RiseClipseModelLoader {
ZipInputStream in = new ZipInputStream( resourceSet.getURIConverter().createInputStream( resourceURIs.get( 0 )));
ZipEntry entry = in.getNextEntry();
if( entry != null ) {
console.verbose( "Found a zip archived file" );
String zipURI = resourceURIs.get( 0 ).toString();
resourceURIs.clear();
while( entry != null ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment