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

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

Introduction

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

Prototype

Level OFF

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

Click Source Link

Document

OFF is a special level that can be used to turn off logging.

Usage

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);//w  w w  .j av a2s. com
    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);
}