Example usage for com.google.gwt.gen2.logging.shared Level ALL

List of usage examples for com.google.gwt.gen2.logging.shared Level ALL

Introduction

In this page you can find the example usage for com.google.gwt.gen2.logging.shared Level ALL.

Prototype

Level ALL

To view the source code for com.google.gwt.gen2.logging.shared Level ALL.

Click Source Link

Document

ALL indicates that all messages should be logged.

Usage

From source file:com.google.gwt.gen2.demo.logging.client.LoggingDemo.java

License:Apache License

/**
 * This is the entry point method.//w  w w. j a va2 s.c o  m
 */
public void onModuleLoad() {
    if (Log.isLoggingSupported() && !Log.isLoggingMinimal()) {
        Gen2CssInjector.addLogHandlerDefault();
        Log.setDefaultLevel(Level.ALL);

        final FlexTable control = new FlexTable();
        RootPanel.get().add(control);
        addLevelControls(control);
        addHandlers(control);
    } else {
        Window.alert("Now that you have logging turned off or to minimal, now check your compiled output.");
        Log.warning("Should be compiled out when logging is turned off or in minimal mode");
        Log.severe("Should be compiled out when logging is turned off, but present in minimal mode");
    }
}

From source file:com.google.gwt.gen2.demo.logging.client.LoggingDemo.java

License:Apache License

private void addLevelControls(final FlexTable control) {
    final TextBox box = new TextBox();
    box.setText("message 0");
    VerticalPanel loggingMessage = new VerticalPanel();
    loggingMessage.add(new Label("Message to log"));
    loggingMessage.add(box);/* ww  w  .  ja v  a  2 s.  c  o  m*/
    control.setWidget(0, 1, loggingMessage);
    Iterator<Level> levels = Log.levelIterator();
    final DropDownListBox<Level> levelList = new DropDownListBox<Level>();

    while (levels.hasNext()) {
        final Level level = levels.next();
        if (level != Level.ALL || level != Level.OFF) {
            levelList.addItem(level.getName(), level, "logging level " + level.getName().toLowerCase(),
                    "use <b> " + level.getName().toLowerCase() + "</b> level");
        }
    }
    control.setWidget(0, 2, levelList);
    levelList.setValue(Level.INFO);

    Button log = new Button("Log message", new ClickListener() {
        public void onClick(Widget sender) {

            Log.log(box.getText(), levelList.getValue(), "user", null);
            box.setText("message " + messageNumber++);
        }
    });

    control.setWidget(0, 3, log);

    Button error = new Button("Log error", new ClickListener() {
        public void onClick(Widget sender) {

            Log.log(box.getText(), levelList.getValue(), "user.error", new NullPointerException());
            box.setText("message " + messageNumber++);
        }
    });

    control.setWidget(0, 4, error);
}