/slf4j-gwt

Simple slf4j api implementation for GWT

Primary LanguageJavaApache License 2.0Apache-2.0

Simple slf4j api implementation for GWT

The aim of this project is to provide developers with an implementation of the Simple Logging Facade for Java (SLF4J 1.7.7) API for the GWT client side. Right now the project provides the basic implementation of the SLF4J API using the java.util.logging (JUL) logging framework supported since GWT 2.1. All logging messages are printed to developer/firebug console. Note that slf4j-gwt depends on the latest stable GWT (GWT 2.7).

Usage

slf4j-gwt is available in maven central

Just include it in your pom.xml

<dependency>
    <groupId>ru.finam</groupId>
    <artifactId>slf4j-gwt</artifactId>
    <version>1.7.7.1</version>
</dependency>

or gradle build:

dependencies {
    compile 'ru.finam:slf4j-gwt:1.7.7.1'
}

or ivy:

<dependency org="ru.finam" name="slf4j-gwt" rev="1.7.7.1" />

Add dependency in your gwt module descriptor (*.gwt.xml):

<inherits name="ru.finam.slf4jgwt.logging.gwt.Logging"/>

You can also set logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE):

<set-property name="gwt.logging.logLevel" value="INFO"/>

Enable or disable gwt logging:

<set-property name="gwt.logging.enabled" value="TRUE"/>

If you want to provide slf4j API (e.g., in library module):

<inherits name="ru.finam.slf4jgwt.api.API"/>

If you want to provide slf4j but to not log anything in your application:

<inherits name="ru.finam.slf4jgwt.logging.nop.NOP"/>

ru.finam.slf4jgwt.logging.util.Util module provides a handful Log class to log messages without instantiating Logger in client code.