diff --git a/apidocs/allclasses-frame.html b/apidocs/allclasses-frame.html index b056654..a1ffdc9 100644 --- a/apidocs/allclasses-frame.html +++ b/apidocs/allclasses-frame.html @@ -2,9 +2,9 @@ - + -All Classes (SLF4Bukkit 0.1.3 API) +All Classes (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/allclasses-noframe.html b/apidocs/allclasses-noframe.html index 94ffd5a..e70de53 100644 --- a/apidocs/allclasses-noframe.html +++ b/apidocs/allclasses-noframe.html @@ -2,9 +2,9 @@ - + -All Classes (SLF4Bukkit 0.1.3 API) +All Classes (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/constant-values.html b/apidocs/constant-values.html index 46bdab5..51e2b04 100644 --- a/apidocs/constant-values.html +++ b/apidocs/constant-values.html @@ -2,16 +2,16 @@ - + -Constant Field Values (SLF4Bukkit 0.1.3 API) +Constant Field Values (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/deprecated-list.html b/apidocs/deprecated-list.html index 8a44782..26b3f75 100644 --- a/apidocs/deprecated-list.html +++ b/apidocs/deprecated-list.html @@ -2,16 +2,16 @@ - + -Deprecated List (SLF4Bukkit 0.1.3 API) +Deprecated List (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/help-doc.html b/apidocs/help-doc.html index e4afae3..c363926 100644 --- a/apidocs/help-doc.html +++ b/apidocs/help-doc.html @@ -2,16 +2,16 @@ - + -API Help (SLF4Bukkit 0.1.3 API) +API Help (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/index-all.html b/apidocs/index-all.html index 95422b3..f82bb7f 100644 --- a/apidocs/index-all.html +++ b/apidocs/index-all.html @@ -2,16 +2,16 @@ - + -Index (SLF4Bukkit 0.1.3 API) +Index (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/index.html b/apidocs/index.html index ffb1998..4048703 100644 --- a/apidocs/index.html +++ b/apidocs/index.html @@ -2,9 +2,9 @@ - + -SLF4Bukkit 0.1.3 API +SLF4Bukkit 0.1.4 API diff --git a/apidocs/info/ronjenkins/slf4bukkit/ColorMarker.html b/apidocs/info/ronjenkins/slf4bukkit/ColorMarker.html index ab8a19e..149add3 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/ColorMarker.html +++ b/apidocs/info/ronjenkins/slf4bukkit/ColorMarker.html @@ -2,16 +2,16 @@ - + -ColorMarker (SLF4Bukkit 0.1.3 API) +ColorMarker (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/ColorString.html b/apidocs/info/ronjenkins/slf4bukkit/ColorString.html index cbcaf22..265fa31 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/ColorString.html +++ b/apidocs/info/ronjenkins/slf4bukkit/ColorString.html @@ -2,16 +2,16 @@ - + -ColorString (SLF4Bukkit 0.1.3 API) +ColorString (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMapper.html b/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMapper.html index 7c343ae..c2006f2 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMapper.html +++ b/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMapper.html @@ -2,16 +2,16 @@ - + -Uses of Class info.ronjenkins.slf4bukkit.ColorMapper (SLF4Bukkit 0.1.3 API) +Uses of Class info.ronjenkins.slf4bukkit.ColorMapper (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMarker.html b/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMarker.html index b8dffa4..21c1107 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMarker.html +++ b/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorMarker.html @@ -2,16 +2,16 @@ - + -Uses of Class info.ronjenkins.slf4bukkit.ColorMarker (SLF4Bukkit 0.1.3 API) +Uses of Class info.ronjenkins.slf4bukkit.ColorMarker (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorString.html b/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorString.html index 993c1c1..bc2c925 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorString.html +++ b/apidocs/info/ronjenkins/slf4bukkit/class-use/ColorString.html @@ -2,16 +2,16 @@ - + -Uses of Class info.ronjenkins.slf4bukkit.ColorString (SLF4Bukkit 0.1.3 API) +Uses of Class info.ronjenkins.slf4bukkit.ColorString (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/package-frame.html b/apidocs/info/ronjenkins/slf4bukkit/package-frame.html index cbfdd11..e08f8fd 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/package-frame.html +++ b/apidocs/info/ronjenkins/slf4bukkit/package-frame.html @@ -2,9 +2,9 @@ - + -info.ronjenkins.slf4bukkit (SLF4Bukkit 0.1.3 API) +info.ronjenkins.slf4bukkit (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/package-summary.html b/apidocs/info/ronjenkins/slf4bukkit/package-summary.html index 5a2fd00..f89e37d 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/package-summary.html +++ b/apidocs/info/ronjenkins/slf4bukkit/package-summary.html @@ -2,16 +2,16 @@ - + -info.ronjenkins.slf4bukkit (SLF4Bukkit 0.1.3 API) +info.ronjenkins.slf4bukkit (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/package-tree.html b/apidocs/info/ronjenkins/slf4bukkit/package-tree.html index 5662eab..56845f9 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/package-tree.html +++ b/apidocs/info/ronjenkins/slf4bukkit/package-tree.html @@ -2,16 +2,16 @@ - + -info.ronjenkins.slf4bukkit Class Hierarchy (SLF4Bukkit 0.1.3 API) +info.ronjenkins.slf4bukkit Class Hierarchy (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/info/ronjenkins/slf4bukkit/package-use.html b/apidocs/info/ronjenkins/slf4bukkit/package-use.html index 3e91483..b123df1 100644 --- a/apidocs/info/ronjenkins/slf4bukkit/package-use.html +++ b/apidocs/info/ronjenkins/slf4bukkit/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package info.ronjenkins.slf4bukkit (SLF4Bukkit 0.1.3 API) +Uses of Package info.ronjenkins.slf4bukkit (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/BukkitLoggerAdapter.html b/apidocs/org/slf4j/impl/BukkitLoggerAdapter.html index 3afb32a..78ebeb2 100644 --- a/apidocs/org/slf4j/impl/BukkitLoggerAdapter.html +++ b/apidocs/org/slf4j/impl/BukkitLoggerAdapter.html @@ -2,16 +2,16 @@ - + -BukkitLoggerAdapter (SLF4Bukkit 0.1.3 API) +BukkitLoggerAdapter (SLF4Bukkit 0.1.4 API) @@ -145,12 +145,13 @@ implements org.slf4j.Logger the current thread name, wrapped in brackets. If unspecified or given any other value, defaults to false. -
  • slf4j.format.LEVEL - Default format for all messages of this - level. Possible values come are Bukkit's ColorMarker values. Both - keys and values in this section are treated as case-insensitive. Invalid +
  • slf4j.colors.LEVEL - Default color for all messages of this + level. Possible values come from SLF4Bukkit's ColorMarker values. + Both keys and values in this section are treated as case-insensitive. Invalid values for either the key or value of an entry result in that entry being - ignored. Default values are: error=RED, warn=YELLOW, others=RESET. - ColorMarkers always override these config values.
  • + ignored. Default values are: error=RED, warn=YELLOW, others=NONE. When used + programmatically via methods in this class, ColorMarkers always + override these config values.
  • slf4j.log.<em>a.b.c</em> - Logging detail level for an SLF4Bukkit logger instance in this plugin named "a.b.c". Right-side value must be one of diff --git a/apidocs/org/slf4j/impl/BukkitLoggerFactory.html b/apidocs/org/slf4j/impl/BukkitLoggerFactory.html index 40fc907..1d09064 100644 --- a/apidocs/org/slf4j/impl/BukkitLoggerFactory.html +++ b/apidocs/org/slf4j/impl/BukkitLoggerFactory.html @@ -2,16 +2,16 @@ - + -BukkitLoggerFactory (SLF4Bukkit 0.1.3 API) +BukkitLoggerFactory (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/StaticLoggerBinder.html b/apidocs/org/slf4j/impl/StaticLoggerBinder.html index 957069f..4fd3b30 100644 --- a/apidocs/org/slf4j/impl/StaticLoggerBinder.html +++ b/apidocs/org/slf4j/impl/StaticLoggerBinder.html @@ -2,16 +2,16 @@ - + -StaticLoggerBinder (SLF4Bukkit 0.1.3 API) +StaticLoggerBinder (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/StaticMDCBinder.html b/apidocs/org/slf4j/impl/StaticMDCBinder.html index 912601e..c24ddbd 100644 --- a/apidocs/org/slf4j/impl/StaticMDCBinder.html +++ b/apidocs/org/slf4j/impl/StaticMDCBinder.html @@ -2,16 +2,16 @@ - + -StaticMDCBinder (SLF4Bukkit 0.1.3 API) +StaticMDCBinder (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/StaticMarkerBinder.html b/apidocs/org/slf4j/impl/StaticMarkerBinder.html index 04305e8..8f9760d 100644 --- a/apidocs/org/slf4j/impl/StaticMarkerBinder.html +++ b/apidocs/org/slf4j/impl/StaticMarkerBinder.html @@ -2,16 +2,16 @@ - + -StaticMarkerBinder (SLF4Bukkit 0.1.3 API) +StaticMarkerBinder (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/class-use/BukkitLoggerAdapter.html b/apidocs/org/slf4j/impl/class-use/BukkitLoggerAdapter.html index e38aa7b..178e700 100644 --- a/apidocs/org/slf4j/impl/class-use/BukkitLoggerAdapter.html +++ b/apidocs/org/slf4j/impl/class-use/BukkitLoggerAdapter.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.BukkitLoggerAdapter (SLF4Bukkit 0.1.3 API) +Uses of Class org.slf4j.impl.BukkitLoggerAdapter (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/class-use/BukkitLoggerFactory.html b/apidocs/org/slf4j/impl/class-use/BukkitLoggerFactory.html index a19a097..adb378c 100644 --- a/apidocs/org/slf4j/impl/class-use/BukkitLoggerFactory.html +++ b/apidocs/org/slf4j/impl/class-use/BukkitLoggerFactory.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.BukkitLoggerFactory (SLF4Bukkit 0.1.3 API) +Uses of Class org.slf4j.impl.BukkitLoggerFactory (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html b/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html index e90f12c..a0f1f9a 100644 --- a/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html +++ b/apidocs/org/slf4j/impl/class-use/StaticLoggerBinder.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.StaticLoggerBinder (SLF4Bukkit 0.1.3 API) +Uses of Class org.slf4j.impl.StaticLoggerBinder (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/class-use/StaticMDCBinder.html b/apidocs/org/slf4j/impl/class-use/StaticMDCBinder.html index 35ba72b..ff83a56 100644 --- a/apidocs/org/slf4j/impl/class-use/StaticMDCBinder.html +++ b/apidocs/org/slf4j/impl/class-use/StaticMDCBinder.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.StaticMDCBinder (SLF4Bukkit 0.1.3 API) +Uses of Class org.slf4j.impl.StaticMDCBinder (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/class-use/StaticMarkerBinder.html b/apidocs/org/slf4j/impl/class-use/StaticMarkerBinder.html index e173ded..72e67eb 100644 --- a/apidocs/org/slf4j/impl/class-use/StaticMarkerBinder.html +++ b/apidocs/org/slf4j/impl/class-use/StaticMarkerBinder.html @@ -2,16 +2,16 @@ - + -Uses of Class org.slf4j.impl.StaticMarkerBinder (SLF4Bukkit 0.1.3 API) +Uses of Class org.slf4j.impl.StaticMarkerBinder (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/package-frame.html b/apidocs/org/slf4j/impl/package-frame.html index deb0102..fed9be5 100644 --- a/apidocs/org/slf4j/impl/package-frame.html +++ b/apidocs/org/slf4j/impl/package-frame.html @@ -2,9 +2,9 @@ - + -org.slf4j.impl (SLF4Bukkit 0.1.3 API) +org.slf4j.impl (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/package-summary.html b/apidocs/org/slf4j/impl/package-summary.html index a3ab22a..db54491 100644 --- a/apidocs/org/slf4j/impl/package-summary.html +++ b/apidocs/org/slf4j/impl/package-summary.html @@ -2,16 +2,16 @@ - + -org.slf4j.impl (SLF4Bukkit 0.1.3 API) +org.slf4j.impl (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/package-tree.html b/apidocs/org/slf4j/impl/package-tree.html index 30c3d1b..2c46153 100644 --- a/apidocs/org/slf4j/impl/package-tree.html +++ b/apidocs/org/slf4j/impl/package-tree.html @@ -2,16 +2,16 @@ - + -org.slf4j.impl Class Hierarchy (SLF4Bukkit 0.1.3 API) +org.slf4j.impl Class Hierarchy (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/org/slf4j/impl/package-use.html b/apidocs/org/slf4j/impl/package-use.html index 2465bce..0a5938e 100644 --- a/apidocs/org/slf4j/impl/package-use.html +++ b/apidocs/org/slf4j/impl/package-use.html @@ -2,16 +2,16 @@ - + -Uses of Package org.slf4j.impl (SLF4Bukkit 0.1.3 API) +Uses of Package org.slf4j.impl (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/overview-frame.html b/apidocs/overview-frame.html index ac3a0ca..06424e6 100644 --- a/apidocs/overview-frame.html +++ b/apidocs/overview-frame.html @@ -2,9 +2,9 @@ - + -Overview List (SLF4Bukkit 0.1.3 API) +Overview List (SLF4Bukkit 0.1.4 API) diff --git a/apidocs/overview-summary.html b/apidocs/overview-summary.html index 7f5b5ee..fa2e1d6 100644 --- a/apidocs/overview-summary.html +++ b/apidocs/overview-summary.html @@ -2,16 +2,16 @@ - + -Overview (SLF4Bukkit 0.1.3 API) +Overview (SLF4Bukkit 0.1.4 API) @@ -64,7 +64,7 @@
    -

    SLF4Bukkit 0.1.3 API

    +

    SLF4Bukkit 0.1.4 API

    diff --git a/apidocs/overview-tree.html b/apidocs/overview-tree.html index 625eaca..d349e08 100644 --- a/apidocs/overview-tree.html +++ b/apidocs/overview-tree.html @@ -2,16 +2,16 @@ - + -Class Hierarchy (SLF4Bukkit 0.1.3 API) +Class Hierarchy (SLF4Bukkit 0.1.4 API) diff --git a/dependencies.html b/dependencies.html index 852e456..5d95366 100644 --- a/dependencies.html +++ b/dependencies.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • @@ -364,7 +364,7 @@

    Dependency Tree

      -
    • info.ronjenkins:slf4bukkit:jar:0.1.3 Information
    • info.ronjenkins:slf4bukkit:jar:0.1.4 Information
    diff --git a/dependency-convergence.html b/dependency-convergence.html index c3c2e2f..3859aae 100644 --- a/dependency-convergence.html +++ b/dependency-convergence.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/devs.html b/devs.html index 4af060a..a4c61d9 100644 --- a/devs.html +++ b/devs.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • @@ -205,7 +205,7 @@
    <dependency>
       <groupId>info.ronjenkins</groupId>
       <artifactId>slf4bukkit</artifactId>
    -  <version>0.1.3</version>
    +  <version>0.1.4</version>
     </dependency>
     
    diff --git a/index.html b/index.html index 18ff477..739cde2 100644 --- a/index.html +++ b/index.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/license.html b/license.html index bbf1910..c9b4095 100644 --- a/license.html +++ b/license.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/plugins.html b/plugins.html index 34610fd..9492823 100644 --- a/plugins.html +++ b/plugins.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/project-info.html b/project-info.html index f987f09..cf31fe6 100644 --- a/project-info.html +++ b/project-info.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/project-reports.html b/project-reports.html index acb7d2c..7a4b3bd 100644 --- a/project-reports.html +++ b/project-reports.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/project-summary.html b/project-summary.html index 1ccfb59..b19d4cf 100644 --- a/project-summary.html +++ b/project-summary.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • @@ -268,7 +268,7 @@ - + diff --git a/source-repository.html b/source-repository.html index 4cc737f..d9d262b 100644 --- a/source-repository.html +++ b/source-repository.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • @@ -244,11 +244,11 @@

    Anonymous Access

    The source can be checked out anonymously from Git with this command (See http://git-scm.com/docs/git-clone):

    -
    $ git clone --branch 0.1.3 git://github.com/rjenkinsjr/slf4bukkit.git
    +
    $ git clone --branch 0.1.4 git://github.com/rjenkinsjr/slf4bukkit.git

    Developer Access

    Only project developers can access the Git tree via this method (See http://git-scm.com/docs/git-clone).

    -
    $ git clone --branch 0.1.3 git@github.com:rjenkinsjr/slf4bukkit.git
    +
    $ git clone --branch 0.1.4 git@github.com:rjenkinsjr/slf4bukkit.git

    Access from Behind a Firewall

    Refer to the documentation of the SCM used for more information about access behind a firewall.

    diff --git a/taglist.html b/taglist.html index 6fd8494..7c485bd 100644 --- a/taglist.html +++ b/taglist.html @@ -125,7 +125,7 @@
  • Last Published: 2016-04-02 |
  • -
  • Version: 0.1.3 +
  • Version: 0.1.4
  • diff --git a/xref/index.html b/xref/index.html index 2c1c3d4..7a732a2 100644 --- a/xref/index.html +++ b/xref/index.html @@ -4,7 +4,7 @@ - SLF4Bukkit 0.1.3 Reference + SLF4Bukkit 0.1.4 Reference diff --git a/xref/info/ronjenkins/slf4bukkit/package-frame.html b/xref/info/ronjenkins/slf4bukkit/package-frame.html index 862dc59..ccd6c20 100644 --- a/xref/info/ronjenkins/slf4bukkit/package-frame.html +++ b/xref/info/ronjenkins/slf4bukkit/package-frame.html @@ -3,7 +3,7 @@ - SLF4Bukkit 0.1.3 Reference Package info.ronjenkins.slf4bukkit + SLF4Bukkit 0.1.4 Reference Package info.ronjenkins.slf4bukkit diff --git a/xref/info/ronjenkins/slf4bukkit/package-summary.html b/xref/info/ronjenkins/slf4bukkit/package-summary.html index b4b267e..ffb9b06 100644 --- a/xref/info/ronjenkins/slf4bukkit/package-summary.html +++ b/xref/info/ronjenkins/slf4bukkit/package-summary.html @@ -3,7 +3,7 @@ - SLF4Bukkit 0.1.3 Reference Package info.ronjenkins.slf4bukkit + SLF4Bukkit 0.1.4 Reference Package info.ronjenkins.slf4bukkit diff --git a/xref/org/slf4j/impl/BukkitLoggerAdapter.html b/xref/org/slf4j/impl/BukkitLoggerAdapter.html index 27b1387..b1a4481 100644 --- a/xref/org/slf4j/impl/BukkitLoggerAdapter.html +++ b/xref/org/slf4j/impl/BukkitLoggerAdapter.html @@ -119,940 +119,941 @@ 111 * the current thread name, wrapped in brackets. If unspecified or given any112 * other value, defaults to {@code false}.</li>113 * -114 * <li>{@code slf4j.format.LEVEL} - Default format for all messages of this -115 * level. Possible values come are Bukkit's {@link ColorMarker} values. Both -116 * keys and values in this section are treated as case-insensitive. Invalid +114 * <li>{@code slf4j.colors.LEVEL} - Default color for all messages of this +115 * level. Possible values come from SLF4Bukkit's {@link ColorMarker} values. +116 * Both keys and values in this section are treated as case-insensitive. Invalid117 * values for either the key or value of an entry result in that entry being -118 * ignored. Default values are: error=RED, warn=YELLOW, others=RESET. -119 * {@link ColorMarker}s always override these config values.</li> -120 * -121 * <li>{@code slf4j.log.<em>a.b.c</em>} - Logging detail level for an SLF4Bukkit -122 * logger instance in this plugin named "a.b.c". Right-side value must be one of -123 * "trace", "debug", "info", "warn", or "error" (case-insensitive). When a -124 * logger named "a.b.c" is initialized, its level is assigned from this -125 * property. If unspecified or given any other value, the level of the nearest -126 * parent logger will be used. If no parent logger level is set, then the value -127 * specified by {@code slf4j.defaultLogLevel} for this plugin will be used.</li> -128 * </ul> -129 * -130 * <p> -131 * SLF4J messages at level {@code TRACE} or {@code DEBUG} are logged to Bukkit -132 * at level {@code INFO} because Bukkit does not enable any levels higher than -133 * {@code INFO}. Therefore, only SLF4J messages at level {@code TRACE} or -134 * {@code DEBUG} show their SLF4J level in the message that is logged to the -135 * server console. -136 * </p> -137 * -138 * <p> -139 * Because SLF4Bukkit's configuration comes from the plugin configuration, -140 * SLF4Bukkit supports configuration reloading. To achieve this, call -141 * {@link #init(boolean)} with argument {@code true} after calling -142 * {@link Plugin#reloadConfig()}. -143 * </p> -144 * -145 * <p> -146 * It is possible for SLF4J loggers to be used before the plugin is registered -147 * with Bukkit's plugin manager. SLF4Bukkit is considered to be -148 * <i>uninitialized</i> as long as the plugin cannot be retrieved from Bukkit's -149 * plugin manager. While in the uninitialized state, SLF4Bukkit: -150 * </p> -151 * -152 * <ul> -153 * <li>uses {@link Bukkit#getLogger()} instead of {@link Plugin#getLogger()}.</li> -154 * <li>uses the default configuration values (see above).</li> -155 * <li>attempts to initialize itself upon every logging call until the plugin is -156 * retrievable from Bukkit's plugin manager, at which point SLF4Bukkit is -157 * considered to be <i>initialized</i>. Once initialized, -158 * {@link Plugin#getLogger()} and {@link Plugin#getConfig() the plugin YAML -159 * configuration values} are used.</li> -160 * </ul> -161 * -162 * <p> -163 * For this reason, it is strongly recommended that you not emit any log -164 * messages via SLF4Bukkit until your plugin's {@link Plugin#onLoad() onLoad()} -165 * method has begun execution. (You can safely log messages inside the -166 * {@code onLoad()} method, because your plugin is registered by that time.) -167 * Logging inside static initializers, the plugin class constructor and other -168 * pre-plugin-registration areas of your code is discouraged. -169 * </p> -170 * -171 * <p> -172 * With no configuration, the default output includes the logger short name and -173 * the message, followed by the line separator for the host. -174 * </p> -175 * -176 * <p> -177 * This logger supports only {@link ColorMarker}s, which are used to format the -178 * logged message and throwable. All other marker types are ignored. The usage -179 * of markers does not affect whether or not a given logging level is enabled. -180 * </p> -181 * -182 * @author Ceki G&uuml;lc&uuml; -183 * @author <a href="mailto:sanders@apache.org">Scott Sanders</a> -184 * @author Rod Waldhoff -185 * @author Robert Burrell Donkin -186 * @author C&eacute;drik LIME -187 * @author Peter Royal -188 * @author Ronald Jack Jenkins Jr. -189 */ -190publicfinalclassBukkitLoggerAdapterimplements Logger { -191 -192// Plugin reference. -193privatestatictransient Plugin BUKKIT_PLUGIN; -194privatestatictransient String BUKKIT_PLUGIN_NAME; -195// Configuration parameters. -196privatestaticfinal String CONFIG_FALLBACK_DEFAULT_LOG_LEVEL = "info"; -197privatestaticfinal Map<Level, ColorMarker> CONFIG_FALLBACK_LEVEL_COLORS = BukkitLoggerAdapter.fallbackLevelColors(); -198privatestaticfinalboolean CONFIG_FALLBACK_SHOW_HEADER = false; -199privatestaticfinalboolean CONFIG_FALLBACK_SHOW_LOG_NAME = false; -200privatestaticfinalboolean CONFIG_FALLBACK_SHOW_SHORT_LOG_NAME = true; -201privatestaticfinalboolean CONFIG_FALLBACK_SHOW_THREAD_NAME = false; -202privatestaticfinal String CONFIG_KEY_DEFAULT_LOG_LEVEL = "slf4j.defaultLogLevel"; -203privatestaticfinal String CONFIG_KEY_LEVEL_COLORS = "slf4j.colors"; -204privatestaticfinal String CONFIG_KEY_PREFIX_LOG = "slf4j.log."; -205privatestaticfinal String CONFIG_KEY_SHOW_HEADER = "slf4j.showHeader"; -206privatestaticfinal String CONFIG_KEY_SHOW_LOG_NAME = "slf4j.showLogName"; -207privatestaticfinal String CONFIG_KEY_SHOW_SHORT_LOG_NAME = "slf4j.showShortLogName"; -208privatestaticfinal String CONFIG_KEY_SHOW_THREAD_NAME = "slf4j.showThreadName"; -209privatestatic Level CONFIG_VALUE_DEFAULT_LOG_LEVEL; -210privatestatic Map<Level, ColorMarker> CONFIG_VALUE_LEVEL_COLORS; -211privatestaticboolean CONFIG_VALUE_SHOW_HEADER; -212privatestaticboolean CONFIG_VALUE_SHOW_LOG_NAME; -213privatestaticboolean CONFIG_VALUE_SHOW_SHORT_LOG_NAME; -214privatestaticboolean CONFIG_VALUE_SHOW_THREAD_NAME; -215// Initialization lock. -216privatestaticfinal Object INITIALIZATION_LOCK = new Object(); -217// The logger name. -218privatefinal String name; -219// The short name of this simple log instance -220privatetransient String shortLogName = null; -221 -222// NOTE: BukkitPluginLoggerAdapter constructor should have only package access -223// so that only BukkitPluginLoggerFactory be able to create one. -224BukkitLoggerAdapter(final String name) { -225this.name = name; -226 } -227 -228/** -229 * (Re)initializes all SLF4Bukkit loggers in this plugin, relying on the YAML -230 * configuration of the plugin. -231 * -232 * @param reinitialize -233 * set to {@code true} to reinitialize all loggers, e.g. after -234 * reloading the plugin config. -235 */ -236publicstaticvoid init(finalboolean reinitialize) { -237synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { -238// Do not re-initialize unless requested. -239if (reinitialize) { -240 BukkitLoggerAdapter.BUKKIT_PLUGIN = null; -241 BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME = null; -242 } elseif (BukkitLoggerAdapter.BUKKIT_PLUGIN != null) { return; } -243// Get a reference to the plugin in this classloader. -244if (BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME == null) { -245 InputStream pluginYmlFile = null; -246try { -247 pluginYmlFile = BukkitLoggerAdapter.class.getClassLoader() -248 .getResource("plugin.yml") -249 .openStream(); -250final Yaml yaml = new Yaml(); -251 @SuppressWarnings("rawtypes") -252final Map pluginYml = (Map) yaml.load(pluginYmlFile); -253 BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME = (String) pluginYml.get("name"); -254 } catch (final IOException e) { -255thrownew IllegalStateException(e); -256 } finally { -257if (pluginYmlFile != null) { -258try { -259 pluginYmlFile.close(); -260 } catch (final IOException e) { -261 e.printStackTrace(); -262 } -263 } -264 } -265 } -266// Try to get the plugin. The logging system will be considered -267// uninitialized until this becomes non-null. While it is null, the Bukkit -268// server logger will be used instead of the plugin logger, and all -269// default configuration options will be used. -270 BukkitLoggerAdapter.BUKKIT_PLUGIN = Bukkit.getPluginManager() -271 .getPlugin(BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME); -272// Get the configuration values. -273// 1. Look in the plugin's on-disk config. -274// 2. If the value is absent, use the plugin's built-in config. -275// 3. If the value is absent, use the default values hardcoded above. -276// (1 and 2 are handled by using the Bukkit API.) -277 BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL = BukkitLoggerAdapter.stringToLevel(BukkitLoggerAdapter.getStringProperty(BukkitLoggerAdapter.CONFIG_KEY_DEFAULT_LOG_LEVEL, -278 BukkitLoggerAdapter.CONFIG_FALLBACK_DEFAULT_LOG_LEVEL)); -279if (BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL == null) { -280 BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL = BukkitLoggerAdapter.stringToLevel(BukkitLoggerAdapter.CONFIG_FALLBACK_DEFAULT_LOG_LEVEL); -281 } -282 BukkitLoggerAdapter.CONFIG_VALUE_LEVEL_COLORS = BukkitLoggerAdapter.getLevelColorsMap(BukkitLoggerAdapter.CONFIG_KEY_LEVEL_COLORS, -283 BukkitLoggerAdapter.CONFIG_FALLBACK_LEVEL_COLORS); -284 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_HEADER = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_HEADER, -285 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_HEADER); -286 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_LOG_NAME = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_LOG_NAME, -287 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_LOG_NAME); -288 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_SHORT_LOG_NAME = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_SHORT_LOG_NAME, -289 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_SHORT_LOG_NAME); -290 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_THREAD_NAME = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_THREAD_NAME, -291 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_THREAD_NAME); -292 } -293 } -294 -295/** -296 * Returns the fallback map of logging levels to their default colors. -297 * -298 * @return never null. -299 */ -300privatestatic Map<Level, ColorMarker> fallbackLevelColors() { -301return ImmutableMap.<Level, ColorMarker> builder() -302 .put(Level.ERROR, ColorMarker.RED) -303 .put(Level.WARN, ColorMarker.YELLOW) -304 .put(Level.INFO, ColorMarker.NONE) -305 .put(Level.DEBUG, ColorMarker.NONE) -306 .put(Level.TRACE, ColorMarker.NONE).build(); -307 } -308 -309/** -310 * Returns a boolean property from the Bukkit plugin config. -311 * -312 * @param name -313 * the desired property. -314 * @param defaultValue -315 * the fallback value returned by this method. -316 * @return {@code defaultValue} if the Bukkit plugin is not available, if the -317 * desired property is not defined in the config, or if the desired -318 * property's value is not either "true" or "false" -319 * (case-insensitive). -320 */ -321privatestaticboolean getBooleanProperty(final String name, -322finalboolean defaultValue) { -323synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { -324if (BukkitLoggerAdapter.BUKKIT_PLUGIN == null) { return defaultValue; } -325final String prop = BukkitLoggerAdapter.BUKKIT_PLUGIN.getConfig() -326 .getString(name); -327if ("true".equalsIgnoreCase(prop)) { returntrue; } -328if ("false".equalsIgnoreCase(prop)) { return false; } -329return defaultValue; -330 } -331 } -332 -333/** -334 * Returns the most appropriate logger. -335 * -336 * @return the logger for the plugin if available; otherwise the server -337 * logger. Never null. -338 */ -339privatestatic java.util.logging.Logger getBukkitLogger() { -340synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { -341return BukkitLoggerAdapter.BUKKIT_PLUGIN == null ? Bukkit.getLogger() -342 : BukkitLoggerAdapter.BUKKIT_PLUGIN.getLogger(); -343 } -344 } -345 -346/** -347 * Returns the map of logging levels to colors, taken from the Bukkit plugin -348 * config. For each relevant entry in the plugin config, if either the key -349 * name or the value name is invalid, that entry is ignored and the default -350 * value is used instead. -351 * -352 * @param property -353 * the config property where the map exists. -354 * @param defaultValue -355 * the fallback values returned by this method. -356 * @return never null, always contains one mapping for each {@link Level}, and -357 * contains no null keys/values. Equal to {@code defaultValue} if the -358 * Bukkit plugin is not available, or if the desired property is not -359 * defined in the config. -360 */ -361privatestatic Map<Level, ColorMarker> -362 getLevelColorsMap(final String property, -363final Map<Level, ColorMarker> defaultValues) { -364synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { -365// Check for the plugin. -366if (BukkitLoggerAdapter.BUKKIT_PLUGIN == null) { return defaultValues; } -367final ConfigurationSection config = BukkitLoggerAdapter.BUKKIT_PLUGIN.getConfig() -368 .getConfigurationSection(property); -369// Quit if the config isn't specified. -370if (config == null) { return defaultValues; } -371// Translate each portion of the config. Skip invalid keys/values. -372final Map<String, Object> configValues = config.getValues(false); -373final Map<Level, ColorMarker> convertedConfigValues = new HashMap<Level, ColorMarker>(); -374for (final Map.Entry<String, Object> configValue : configValues.entrySet()) { -375final String levelName = configValue.getKey().toUpperCase(); -376final String formatName = configValue.getValue().toString() -377 .toUpperCase(); -378 Level level; -379ColorMarker format; -380try { -381 level = Level.valueOf(levelName); -382 format = ColorMarker.valueOf(formatName); -383 } catch (final IllegalArgumentException e) { -384// This is expected, so don't log it. -385continue; -386 } -387 convertedConfigValues.put(level, format); -388 } -389// Merge the default and config-based map; the latter takes priority. -390final Map<Level, ColorMarker> finalConfigValues = new HashMap<Level, ColorMarker>(); -391 finalConfigValues.putAll(defaultValues); -392 finalConfigValues.putAll(convertedConfigValues); -393// Done; cast as immutable. -394return ImmutableMap.<Level, ColorMarker> builder() -395 .putAll(finalConfigValues).build(); -396 } -397 } -398 -399/** -400 * Returns a string property from the Bukkit plugin config. -401 * -402 * @param name -403 * the desired property. -404 * @param defaultValue -405 * the fallback value returned by this method. -406 * @return {@code defaultValue} if the Bukkit plugin is not available, or if -407 * the desired property is not defined in the config. -408 */ -409privatestatic String getStringProperty(final String name, -410final String defaultValue) { -411synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { -412if (BukkitLoggerAdapter.BUKKIT_PLUGIN == null) { return defaultValue; } -413final String prop = BukkitLoggerAdapter.BUKKIT_PLUGIN.getConfig() -414 .getString(name); -415return (prop == null) ? defaultValue : prop; -416 } -417 } -418 -419/** -420 * Converts an SLF4J logging level to a Bukkit logging level. -421 * -422 * <ul> -423 * <li>{@link Level#ERROR} maps to {@link java.util.logging.Level#SEVERE}.</li> -424 * <li>{@link Level#WARN} maps to {@link java.util.logging.Level#WARNING}.</li> -425 * <li>All others map to {@link java.util.logging.Level#INFO} (Bukkit won't -426 * log any messages higher than {@code INFO}).</li> -427 * </ul> -428 * -429 * @param slf4jLevel -430 * any SLF4J logging level. -431 * @return never null. -432 */ -433privatestatic java.util.logging.Level -434 slf4jLevelIntToBukkitJULLevel(final Level slf4jLevel) { -435 java.util.logging.Level julLevel; -436switch (slf4jLevel) { -437case ERROR: -438 julLevel = java.util.logging.Level.SEVERE; -439break; -440case WARN: -441 julLevel = java.util.logging.Level.WARNING; -442break; -443default: -444// In Bukkit, Only the SEVERE, WARNING and INFO JUL levels are enabled, -445// so SLF4J's TRACE and DEBUG levels must be logged at Bukkit's INFO -446// level. -447 julLevel = java.util.logging.Level.INFO; -448break; -449 } -450return julLevel; -451 } -452 -453/** -454 * Convert YAML logging level properties to SLF4J level objects. -455 * -456 * @param levelStr -457 * the level property value from the YAML config. -458 * @return null iff the input does not map to a SLF4J logging level name in a -459 * case-insensitive fashion. -460 */ -461privatestatic Level stringToLevel(final String levelStr) { -462if ("trace".equalsIgnoreCase(levelStr)) { -463return Level.TRACE; -464 } elseif ("debug".equalsIgnoreCase(levelStr)) { -465return Level.DEBUG; -466 } elseif ("info".equalsIgnoreCase(levelStr)) { -467return Level.INFO; -468 } elseif ("warn".equalsIgnoreCase(levelStr)) { -469return Level.WARN; -470 } elseif ("error".equalsIgnoreCase(levelStr)) { -471return Level.ERROR; -472 } else { -473returnnull; -474 } -475 } -476 -477 @Override -478publicvoid debug(final Marker marker, final String msg) { -479if (!this.isDebugEnabled()) { return; } -480this.log(Level.DEBUG, marker, msg, null); -481 } -482 -483 @Override -484publicvoid debug(final Marker marker, final String format, final Object arg) { -485if (!this.isDebugEnabled()) { return; } -486this.formatAndLog(Level.DEBUG, marker, format, arg, null); -487 } -488 -489 @Override -490publicvoid debug(final Marker marker, final String format, -491final Object... arguments) { -492if (!this.isDebugEnabled()) { return; } -493this.formatAndLog(Level.DEBUG, marker, format, arguments); -494 } -495 -496 @Override -497publicvoid debug(final Marker marker, final String format, -498final Object arg1, final Object arg2) { -499if (!this.isDebugEnabled()) { return; } -500this.formatAndLog(Level.DEBUG, marker, format, arg1, arg2); -501 } -502 -503 @Override -504publicvoid debug(final Marker marker, final String msg, final Throwable t) { -505if (!this.isDebugEnabled()) { return; } -506this.log(Level.DEBUG, marker, msg, t); -507 } -508 -509 @Override -510publicvoid debug(final String msg) { -511if (!this.isDebugEnabled()) { return; } -512this.log(Level.DEBUG, null, msg, null); -513 } -514 -515 @Override -516publicvoid debug(final String format, final Object arg) { -517if (!this.isDebugEnabled()) { return; } -518this.formatAndLog(Level.DEBUG, null, format, arg, null); -519 } -520 -521 @Override -522publicvoid debug(final String format, final Object... arguments) { -523if (!this.isDebugEnabled()) { return; } -524this.formatAndLog(Level.DEBUG, null, format, arguments); -525 } -526 -527 @Override -528publicvoid debug(final String format, final Object arg1, final Object arg2) { -529if (!this.isDebugEnabled()) { return; } -530this.formatAndLog(Level.DEBUG, null, format, arg1, arg2); -531 } -532 -533 @Override -534publicvoid debug(final String msg, final Throwable t) { -535if (!this.isDebugEnabled()) { return; } -536this.log(Level.DEBUG, null, msg, t); -537 } -538 -539 @Override -540publicvoid error(final Marker marker, final String msg) { -541if (!this.isErrorEnabled()) { return; } -542this.log(Level.ERROR, marker, msg, null); -543 } -544 -545 @Override -546publicvoid error(final Marker marker, final String format, final Object arg) { -547if (!this.isErrorEnabled()) { return; } -548this.formatAndLog(Level.ERROR, marker, format, arg, null); -549 } -550 -551 @Override -552publicvoid error(final Marker marker, final String format, -553final Object... arguments) { -554if (!this.isErrorEnabled()) { return; } -555this.formatAndLog(Level.ERROR, marker, format, arguments); -556 } -557 -558 @Override -559publicvoid error(final Marker marker, final String format, -560final Object arg1, final Object arg2) { -561if (!this.isErrorEnabled()) { return; } -562this.formatAndLog(Level.ERROR, marker, format, arg1, arg2); -563 } -564 -565 @Override -566publicvoid error(final Marker marker, final String msg, final Throwable t) { -567if (!this.isErrorEnabled()) { return; } -568this.log(Level.ERROR, marker, msg, t); -569 } -570 -571 @Override -572publicvoid error(final String msg) { -573if (!this.isErrorEnabled()) { return; } -574this.log(Level.ERROR, null, msg, null); -575 } -576 -577 @Override -578publicvoid error(final String format, final Object arg) { -579if (!this.isErrorEnabled()) { return; } -580this.formatAndLog(Level.ERROR, null, format, arg, null); -581 } -582 -583 @Override -584publicvoid error(final String format, final Object... arguments) { -585if (!this.isErrorEnabled()) { return; } -586this.formatAndLog(Level.ERROR, null, format, arguments); -587 } -588 -589 @Override -590publicvoid error(final String format, final Object arg1, final Object arg2) { -591if (!this.isErrorEnabled()) { return; } -592this.formatAndLog(Level.ERROR, null, format, arg1, arg2); -593 } -594 -595 @Override -596publicvoid error(final String msg, final Throwable t) { -597if (!this.isErrorEnabled()) { return; } -598this.log(Level.ERROR, null, msg, t); -599 } -600 -601 @Override -602public String getName() { -603returnthis.name; -604 } -605 -606 @Override -607publicvoid info(final Marker marker, final String msg) { -608if (!this.isInfoEnabled()) { return; } -609this.log(Level.INFO, marker, msg, null); -610 } -611 -612 @Override -613publicvoid info(final Marker marker, final String format, final Object arg) { -614if (!this.isInfoEnabled()) { return; } -615this.formatAndLog(Level.INFO, marker, format, arg, null); -616 } -617 -618 @Override -619publicvoid info(final Marker marker, final String format, -620final Object... arguments) { -621if (!this.isInfoEnabled()) { return; } -622this.formatAndLog(Level.INFO, marker, format, arguments); -623 } -624 -625 @Override -626publicvoid info(final Marker marker, final String format, final Object arg1, -627final Object arg2) { -628if (!this.isInfoEnabled()) { return; } -629this.formatAndLog(Level.INFO, marker, format, arg1, arg2); -630 } -631 -632 @Override -633publicvoid info(final Marker marker, final String msg, final Throwable t) { -634if (!this.isInfoEnabled()) { return; } -635this.log(Level.INFO, marker, msg, t); -636 } -637 -638 @Override -639publicvoid info(final String msg) { -640if (!this.isInfoEnabled()) { return; } -641this.log(Level.INFO, null, msg, null); -642 } -643 -644 @Override -645publicvoid info(final String format, final Object arg) { -646if (!this.isInfoEnabled()) { return; } -647this.formatAndLog(Level.INFO, null, format, arg, null); -648 } -649 -650 @Override -651publicvoid info(final String format, final Object... arguments) { -652if (!this.isInfoEnabled()) { return; } -653this.formatAndLog(Level.INFO, null, format, arguments); -654 } -655 -656 @Override -657publicvoid info(final String format, final Object arg1, final Object arg2) { -658if (!this.isInfoEnabled()) { return; } -659this.formatAndLog(Level.INFO, null, format, arg1, arg2); -660 } -661 -662 @Override -663publicvoid info(final String msg, final Throwable t) { -664if (!this.isInfoEnabled()) { return; } -665this.log(Level.INFO, null, msg, t); -666 } -667 -668 @Override -669publicboolean isDebugEnabled() { -670returnthis.isLevelEnabled(Level.DEBUG); -671 } -672 -673 @Override -674publicboolean isDebugEnabled(final Marker marker) { -675returnthis.isLevelEnabled(Level.DEBUG); -676 } -677 -678 @Override -679publicboolean isErrorEnabled() { -680returnthis.isLevelEnabled(Level.ERROR); -681 } -682 -683 @Override -684publicboolean isErrorEnabled(final Marker marker) { -685returnthis.isLevelEnabled(Level.ERROR); -686 } -687 -688 @Override -689publicboolean isInfoEnabled() { -690returnthis.isLevelEnabled(Level.INFO); -691 } -692 -693 @Override -694publicboolean isInfoEnabled(final Marker marker) { -695returnthis.isLevelEnabled(Level.INFO); -696 } -697 -698 @Override -699publicboolean isTraceEnabled() { -700returnthis.isLevelEnabled(Level.TRACE); -701 } -702 -703 @Override -704publicboolean isTraceEnabled(final Marker marker) { -705returnthis.isLevelEnabled(Level.TRACE); -706 } -707 -708 @Override -709publicboolean isWarnEnabled() { -710returnthis.isLevelEnabled(Level.WARN); -711 } -712 -713 @Override -714publicboolean isWarnEnabled(final Marker marker) { -715returnthis.isLevelEnabled(Level.WARN); -716 } -717 -718 @Override -719publicvoid trace(final Marker marker, final String msg) { -720if (!this.isTraceEnabled()) { return; } -721this.log(Level.TRACE, marker, msg, null); -722 } -723 -724 @Override -725publicvoid trace(final Marker marker, final String format, final Object arg) { -726if (!this.isTraceEnabled()) { return; } -727this.formatAndLog(Level.TRACE, marker, format, arg, null); -728 } -729 -730 @Override -731publicvoid trace(final Marker marker, final String format, -732final Object... arguments) { -733if (!this.isTraceEnabled()) { return; } -734this.formatAndLog(Level.TRACE, marker, format, arguments); -735 } -736 -737 @Override -738publicvoid trace(final Marker marker, final String format, -739final Object arg1, final Object arg2) { -740if (!this.isTraceEnabled()) { return; } -741this.formatAndLog(Level.TRACE, marker, format, arg1, arg2); -742 } -743 -744 @Override -745publicvoid trace(final Marker marker, final String msg, final Throwable t) { -746if (!this.isTraceEnabled()) { return; } -747this.log(Level.TRACE, marker, msg, t); -748 } -749 -750 @Override -751publicvoid trace(final String msg) { -752if (!this.isTraceEnabled()) { return; } -753this.log(Level.TRACE, null, msg, null); -754 } -755 -756 @Override -757publicvoid trace(final String format, final Object arg) { -758if (!this.isTraceEnabled()) { return; } -759this.formatAndLog(Level.TRACE, null, format, arg, null); -760 } -761 -762 @Override -763publicvoid trace(final String format, final Object... arguments) { -764if (!this.isTraceEnabled()) { return; } -765this.formatAndLog(Level.TRACE, null, format, arguments); -766 } -767 -768 @Override -769publicvoid trace(final String format, final Object arg1, final Object arg2) { -770if (!this.isTraceEnabled()) { return; } -771this.formatAndLog(Level.TRACE, null, format, arg1, arg2); -772 } -773 -774 @Override -775publicvoid trace(final String msg, final Throwable t) { -776if (!this.isTraceEnabled()) { return; } -777this.log(Level.TRACE, null, msg, t); -778 } -779 -780 @Override -781publicvoid warn(final Marker marker, final String msg) { -782if (!this.isWarnEnabled()) { return; } -783this.log(Level.WARN, marker, msg, null); -784 } -785 -786 @Override -787publicvoid warn(final Marker marker, final String format, final Object arg) { -788if (!this.isWarnEnabled()) { return; } -789this.formatAndLog(Level.WARN, marker, format, arg, null); -790 } -791 -792 @Override -793publicvoid warn(final Marker marker, final String format, -794final Object... arguments) { -795if (!this.isWarnEnabled()) { return; } -796this.formatAndLog(Level.WARN, marker, format, arguments); -797 } -798 -799 @Override -800publicvoid warn(final Marker marker, final String format, final Object arg1, -801final Object arg2) { -802if (!this.isWarnEnabled()) { return; } -803this.formatAndLog(Level.WARN, marker, format, arg1, arg2); -804 } -805 -806 @Override -807publicvoid warn(final Marker marker, final String msg, final Throwable t) { -808if (!this.isWarnEnabled()) { return; } -809this.log(Level.WARN, marker, msg, t); -810 } -811 -812 @Override -813publicvoid warn(final String msg) { -814if (!this.isWarnEnabled()) { return; } -815this.log(Level.WARN, null, msg, null); -816 } -817 -818 @Override -819publicvoid warn(final String format, final Object arg) { -820if (!this.isWarnEnabled()) { return; } -821this.formatAndLog(Level.WARN, null, format, arg, null); -822 } -823 -824 @Override -825publicvoid warn(final String format, final Object... arguments) { -826if (!this.isWarnEnabled()) { return; } -827this.formatAndLog(Level.WARN, null, format, arguments); -828 } -829 -830 @Override -831publicvoid warn(final String format, final Object arg1, final Object arg2) { -832if (!this.isWarnEnabled()) { return; } -833this.formatAndLog(Level.WARN, null, format, arg1, arg2); -834 } -835 -836 @Override -837publicvoid warn(final String msg, final Throwable t) { -838if (!this.isWarnEnabled()) { return; } -839this.log(Level.WARN, null, msg, t); -840 } -841 -842/** -843 * Computes this logger's short name, which is equivalent to the short Java -844 * package name format (e.g. a logger named "info.ronjenkins.bukkit.MyPlugin" -845 * would have a short name of "i.r.b.MyPlugin"). -846 * -847 * @return never null. -848 */ -849private String computeShortName() { -850final List<String> splitName = new ArrayList<String>(); -851 splitName.addAll(Arrays.asList(this.name.split("\\."))); -852finalint shortNameLength = ((splitName.size() - 1) * 2) -853 + splitName.get(splitName.size() - 1).length(); -854final String finalName = splitName.remove(splitName.size() - 1); -855final StringBuffer shortName = new StringBuffer(shortNameLength); -856for (final String part : splitName) { -857 shortName.append(part.charAt(0)).append('.'); -858 } -859 shortName.append(finalName); -860return shortName.toString(); -861 } -862 -863/** -864 * Computes this logger's current logging level, based on the Bukkit plugin -865 * config. -866 * -867 * @return the value of "slf4j.defaultLogLevel" if neither this logger nor any -868 * of its ancestors define a logging level. -869 */ -870private Level determineCurrentLevel() { -871// Compute the current level, which may be null. -872 String tempName = this.name; -873 Level level = null; -874int indexOfLastDot = tempName.length(); -875while ((level == null) && (indexOfLastDot > -1)) { -876 tempName = tempName.substring(0, indexOfLastDot); -877 level = BukkitLoggerAdapter.stringToLevel(BukkitLoggerAdapter.getStringProperty(BukkitLoggerAdapter.CONFIG_KEY_PREFIX_LOG -878 + tempName, -879null)); -880 indexOfLastDot = String.valueOf(tempName).lastIndexOf("."); -881 } -882// Return the default value if we got null. -883return (level == null) ? BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL -884 : level; -885 } -886 -887/** -888 * For formatted messages, first substitute arguments and then log. -889 * -890 * @param level -891 * the level of this message. -892 * @param marker -893 * the marker to use for this message, may be null. -894 * @param format -895 * the message format string. -896 * @param arguments -897 * 3 or more arguments. -898 */ -899privatevoid formatAndLog(final Level level, final Marker marker, -900final String format, final Object... arguments) { -901if (!this.isLevelEnabled(level)) { return; } -902final FormattingTuple tp = MessageFormatter.arrayFormat(format, arguments); -903this.log(level, marker, tp.getMessage(), tp.getThrowable()); -904 } -905 -906/** -907 * For formatted messages, first substitute arguments and then log. -908 * -909 * @param level -910 * the level of this message. -911 * @param marker -912 * the marker to use for this message, may be null. -913 * @param format -914 * the message format string. -915 * @param arg1 -916 * format argument #1. -917 * @param arg2 -918 * format argument #2. -919 */ -920privatevoid formatAndLog(final Level level, final Marker marker, -921final String format, final Object arg1, -922final Object arg2) { -923if (!this.isLevelEnabled(level)) { return; } -924final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); -925this.log(level, marker, tp.getMessage(), tp.getThrowable()); -926 } -927 -928/** -929 * Is the given log level currently enabled? -930 * -931 * @param logLevel -932 * is this level enabled? -933 * @return true if enabled, false if disabled. -934 */ -935privateboolean isLevelEnabled(final Level logLevel) { -936// Ensure that SLF4Bukkit is initialized. Every public API call passes -937// through this method, so this is the appropriate place to ensure -938// initialization. -939 BukkitLoggerAdapter.init(false); -940// log level are numerically ordered so can use simple numeric comparison -941// -942// the PLUGIN.getLogger().isLoggable() check avoids the unconditional -943// construction of location data for disabled log statements. As of -944// 2008-07-31, callers of this method do not perform this check. See also -945// http://jira.qos.ch/browse/SLF4J-81 -946final Level currentLogLevel = this.determineCurrentLevel(); -947return (logLevel.toInt() >= currentLogLevel.toInt()) -948 && (BukkitLoggerAdapter.getBukkitLogger().isLoggable(BukkitLoggerAdapter.slf4jLevelIntToBukkitJULLevel(logLevel))); -949 } -950 -951/** -952 * Assembles the final log message and sends it to the appropriate Bukkit -953 * logger. -954 * -955 * @param level -956 * the desired log level of the message. -957 * @param marker -958 * the marker to use for this message, may be null. -959 * @param message -960 * the message to be logged. -961 * @param throwable -962 * the exception to be logged, may be null. -963 */ -964privatevoid log(final Level level, final Marker marker, -965final String message, final Throwable throwable) { -966final java.util.logging.Logger logger; -967synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { -968// Ensure that the logger will accept this request. -969if (!this.isLevelEnabled(level)) { return; } -970// Determine which logger will be used. -971 logger = BukkitLoggerAdapter.getBukkitLogger(); -972 } -973 -974// Start building the log message. -975final StringBuilder buf = new StringBuilder(32); -976boolean hasHeader = false; -977 -978// Use the marker, if applicable. Otherwise, use the default color for -979// this level. -980if (marker instanceof ColorMarker) { -981 buf.append(((ColorMarker) marker).getValue()); -982 } else { -983 buf.append(BukkitLoggerAdapter.CONFIG_VALUE_LEVEL_COLORS.get(level) -984 .getValue()); -985 } -986 -987// Indicate that this message comes from SLF4J, if desired. -988if (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_HEADER) { -989 hasHeader = true; -990 buf.append("[SLF4J]"); -991 } -992 -993// Print a readable representation of the log level, but only for log levels -994// that Bukkit would otherwise eat. -995switch (level) { -996case TRACE: -997 hasHeader = true; -998 buf.append("[TRACE]"); -999break; -1000case DEBUG: -1001 hasHeader = true; -1002 buf.append("[DEBUG]"); -1003break; -1004default: -1005break; -1006 } -1007 -1008// Append the current thread name, if desired. -1009if (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_THREAD_NAME) { -1010 hasHeader = true; -1011 buf.append('['); -1012 buf.append(Thread.currentThread().getName()); -1013 buf.append("]"); -1014 } -1015 -1016// Buffer the current output with a space, unless there is no output. -1017if (hasHeader) { -1018 buf.append(' '); -1019 } -1020 -1021// Append the name of the log instance, if desired. -1022if (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_LOG_NAME) { -1023 buf.append('{').append(this.name).append("} "); -1024 } elseif (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_SHORT_LOG_NAME) { -1025if (this.shortLogName == null) { -1026this.shortLogName = this.computeShortName(); -1027 } -1028 buf.append('{').append(this.shortLogName).append("} "); -1029 } -1030 -1031// Append the message. -1032 buf.append(message); -1033 -1034// Append the throwable, if applicable. -1035if (throwable != null) { -1036 buf.append('\n').append(ExceptionUtils.getFullStackTrace(throwable) -1037 .trim()); -1038 } -1039 -1040// Append a reset directive. -1041 buf.append(ChatColor.RESET); -1042 -1043// Log the message. -1044 logger.log(BukkitLoggerAdapter.slf4jLevelIntToBukkitJULLevel(level), -1045 ColorMapper.map(buf.toString())); -1046 } -1047 } +118 * ignored. Default values are: error=RED, warn=YELLOW, others=NONE. When used +119 * programmatically via methods in this class, {@link ColorMarker}s always +120 * override these config values.</li> +121 * +122 * <li>{@code slf4j.log.<em>a.b.c</em>} - Logging detail level for an SLF4Bukkit +123 * logger instance in this plugin named "a.b.c". Right-side value must be one of +124 * "trace", "debug", "info", "warn", or "error" (case-insensitive). When a +125 * logger named "a.b.c" is initialized, its level is assigned from this +126 * property. If unspecified or given any other value, the level of the nearest +127 * parent logger will be used. If no parent logger level is set, then the value +128 * specified by {@code slf4j.defaultLogLevel} for this plugin will be used.</li> +129 * </ul> +130 * +131 * <p> +132 * SLF4J messages at level {@code TRACE} or {@code DEBUG} are logged to Bukkit +133 * at level {@code INFO} because Bukkit does not enable any levels higher than +134 * {@code INFO}. Therefore, only SLF4J messages at level {@code TRACE} or +135 * {@code DEBUG} show their SLF4J level in the message that is logged to the +136 * server console. +137 * </p> +138 * +139 * <p> +140 * Because SLF4Bukkit's configuration comes from the plugin configuration, +141 * SLF4Bukkit supports configuration reloading. To achieve this, call +142 * {@link #init(boolean)} with argument {@code true} after calling +143 * {@link Plugin#reloadConfig()}. +144 * </p> +145 * +146 * <p> +147 * It is possible for SLF4J loggers to be used before the plugin is registered +148 * with Bukkit's plugin manager. SLF4Bukkit is considered to be +149 * <i>uninitialized</i> as long as the plugin cannot be retrieved from Bukkit's +150 * plugin manager. While in the uninitialized state, SLF4Bukkit: +151 * </p> +152 * +153 * <ul> +154 * <li>uses {@link Bukkit#getLogger()} instead of {@link Plugin#getLogger()}.</li> +155 * <li>uses the default configuration values (see above).</li> +156 * <li>attempts to initialize itself upon every logging call until the plugin is +157 * retrievable from Bukkit's plugin manager, at which point SLF4Bukkit is +158 * considered to be <i>initialized</i>. Once initialized, +159 * {@link Plugin#getLogger()} and {@link Plugin#getConfig() the plugin YAML +160 * configuration values} are used.</li> +161 * </ul> +162 * +163 * <p> +164 * For this reason, it is strongly recommended that you not emit any log +165 * messages via SLF4Bukkit until your plugin's {@link Plugin#onLoad() onLoad()} +166 * method has begun execution. (You can safely log messages inside the +167 * {@code onLoad()} method, because your plugin is registered by that time.) +168 * Logging inside static initializers, the plugin class constructor and other +169 * pre-plugin-registration areas of your code is discouraged. +170 * </p> +171 * +172 * <p> +173 * With no configuration, the default output includes the logger short name and +174 * the message, followed by the line separator for the host. +175 * </p> +176 * +177 * <p> +178 * This logger supports only {@link ColorMarker}s, which are used to format the +179 * logged message and throwable. All other marker types are ignored. The usage +180 * of markers does not affect whether or not a given logging level is enabled. +181 * </p> +182 * +183 * @author Ceki G&uuml;lc&uuml; +184 * @author <a href="mailto:sanders@apache.org">Scott Sanders</a> +185 * @author Rod Waldhoff +186 * @author Robert Burrell Donkin +187 * @author C&eacute;drik LIME +188 * @author Peter Royal +189 * @author Ronald Jack Jenkins Jr. +190 */ +191publicfinalclassBukkitLoggerAdapterimplements Logger { +192 +193// Plugin reference. +194privatestatictransient Plugin BUKKIT_PLUGIN; +195privatestatictransient String BUKKIT_PLUGIN_NAME; +196// Configuration parameters. +197privatestaticfinal String CONFIG_FALLBACK_DEFAULT_LOG_LEVEL = "info"; +198privatestaticfinal Map<Level, ColorMarker> CONFIG_FALLBACK_LEVEL_COLORS = BukkitLoggerAdapter.fallbackLevelColors(); +199privatestaticfinalboolean CONFIG_FALLBACK_SHOW_HEADER = false; +200privatestaticfinalboolean CONFIG_FALLBACK_SHOW_LOG_NAME = false; +201privatestaticfinalboolean CONFIG_FALLBACK_SHOW_SHORT_LOG_NAME = true; +202privatestaticfinalboolean CONFIG_FALLBACK_SHOW_THREAD_NAME = false; +203privatestaticfinal String CONFIG_KEY_DEFAULT_LOG_LEVEL = "slf4j.defaultLogLevel"; +204privatestaticfinal String CONFIG_KEY_LEVEL_COLORS = "slf4j.colors"; +205privatestaticfinal String CONFIG_KEY_PREFIX_LOG = "slf4j.log."; +206privatestaticfinal String CONFIG_KEY_SHOW_HEADER = "slf4j.showHeader"; +207privatestaticfinal String CONFIG_KEY_SHOW_LOG_NAME = "slf4j.showLogName"; +208privatestaticfinal String CONFIG_KEY_SHOW_SHORT_LOG_NAME = "slf4j.showShortLogName"; +209privatestaticfinal String CONFIG_KEY_SHOW_THREAD_NAME = "slf4j.showThreadName"; +210privatestatic Level CONFIG_VALUE_DEFAULT_LOG_LEVEL; +211privatestatic Map<Level, ColorMarker> CONFIG_VALUE_LEVEL_COLORS; +212privatestaticboolean CONFIG_VALUE_SHOW_HEADER; +213privatestaticboolean CONFIG_VALUE_SHOW_LOG_NAME; +214privatestaticboolean CONFIG_VALUE_SHOW_SHORT_LOG_NAME; +215privatestaticboolean CONFIG_VALUE_SHOW_THREAD_NAME; +216// Initialization lock. +217privatestaticfinal Object INITIALIZATION_LOCK = new Object(); +218// The logger name. +219privatefinal String name; +220// The short name of this simple log instance +221privatetransient String shortLogName = null; +222 +223// NOTE: BukkitPluginLoggerAdapter constructor should have only package access +224// so that only BukkitPluginLoggerFactory be able to create one. +225BukkitLoggerAdapter(final String name) { +226this.name = name; +227 } +228 +229/** +230 * (Re)initializes all SLF4Bukkit loggers in this plugin, relying on the YAML +231 * configuration of the plugin. +232 * +233 * @param reinitialize +234 * set to {@code true} to reinitialize all loggers, e.g. after +235 * reloading the plugin config. +236 */ +237publicstaticvoid init(finalboolean reinitialize) { +238synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { +239// Do not re-initialize unless requested. +240if (reinitialize) { +241 BukkitLoggerAdapter.BUKKIT_PLUGIN = null; +242 BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME = null; +243 } elseif (BukkitLoggerAdapter.BUKKIT_PLUGIN != null) { return; } +244// Get a reference to the plugin in this classloader. +245if (BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME == null) { +246 InputStream pluginYmlFile = null; +247try { +248 pluginYmlFile = BukkitLoggerAdapter.class.getClassLoader() +249 .getResource("plugin.yml") +250 .openStream(); +251final Yaml yaml = new Yaml(); +252 @SuppressWarnings("rawtypes") +253final Map pluginYml = (Map) yaml.load(pluginYmlFile); +254 BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME = (String) pluginYml.get("name"); +255 } catch (final IOException e) { +256thrownew IllegalStateException(e); +257 } finally { +258if (pluginYmlFile != null) { +259try { +260 pluginYmlFile.close(); +261 } catch (final IOException e) { +262 e.printStackTrace(); +263 } +264 } +265 } +266 } +267// Try to get the plugin. The logging system will be considered +268// uninitialized until this becomes non-null. While it is null, the Bukkit +269// server logger will be used instead of the plugin logger, and all +270// default configuration options will be used. +271 BukkitLoggerAdapter.BUKKIT_PLUGIN = Bukkit.getPluginManager() +272 .getPlugin(BukkitLoggerAdapter.BUKKIT_PLUGIN_NAME); +273// Get the configuration values. +274// 1. Look in the plugin's on-disk config. +275// 2. If the value is absent, use the plugin's built-in config. +276// 3. If the value is absent, use the default values hardcoded above. +277// (1 and 2 are handled by using the Bukkit API.) +278 BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL = BukkitLoggerAdapter.stringToLevel(BukkitLoggerAdapter.getStringProperty(BukkitLoggerAdapter.CONFIG_KEY_DEFAULT_LOG_LEVEL, +279 BukkitLoggerAdapter.CONFIG_FALLBACK_DEFAULT_LOG_LEVEL)); +280if (BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL == null) { +281 BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL = BukkitLoggerAdapter.stringToLevel(BukkitLoggerAdapter.CONFIG_FALLBACK_DEFAULT_LOG_LEVEL); +282 } +283 BukkitLoggerAdapter.CONFIG_VALUE_LEVEL_COLORS = BukkitLoggerAdapter.getLevelColorsMap(BukkitLoggerAdapter.CONFIG_KEY_LEVEL_COLORS, +284 BukkitLoggerAdapter.CONFIG_FALLBACK_LEVEL_COLORS); +285 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_HEADER = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_HEADER, +286 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_HEADER); +287 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_LOG_NAME = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_LOG_NAME, +288 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_LOG_NAME); +289 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_SHORT_LOG_NAME = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_SHORT_LOG_NAME, +290 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_SHORT_LOG_NAME); +291 BukkitLoggerAdapter.CONFIG_VALUE_SHOW_THREAD_NAME = BukkitLoggerAdapter.getBooleanProperty(BukkitLoggerAdapter.CONFIG_KEY_SHOW_THREAD_NAME, +292 BukkitLoggerAdapter.CONFIG_FALLBACK_SHOW_THREAD_NAME); +293 } +294 } +295 +296/** +297 * Returns the fallback map of logging levels to their default colors. +298 * +299 * @return never null. +300 */ +301privatestatic Map<Level, ColorMarker> fallbackLevelColors() { +302return ImmutableMap.<Level, ColorMarker> builder() +303 .put(Level.ERROR, ColorMarker.RED) +304 .put(Level.WARN, ColorMarker.YELLOW) +305 .put(Level.INFO, ColorMarker.NONE) +306 .put(Level.DEBUG, ColorMarker.NONE) +307 .put(Level.TRACE, ColorMarker.NONE).build(); +308 } +309 +310/** +311 * Returns a boolean property from the Bukkit plugin config. +312 * +313 * @param name +314 * the desired property. +315 * @param defaultValue +316 * the fallback value returned by this method. +317 * @return {@code defaultValue} if the Bukkit plugin is not available, if the +318 * desired property is not defined in the config, or if the desired +319 * property's value is not either "true" or "false" +320 * (case-insensitive). +321 */ +322privatestaticboolean getBooleanProperty(final String name, +323finalboolean defaultValue) { +324synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { +325if (BukkitLoggerAdapter.BUKKIT_PLUGIN == null) { return defaultValue; } +326final String prop = BukkitLoggerAdapter.BUKKIT_PLUGIN.getConfig() +327 .getString(name); +328if ("true".equalsIgnoreCase(prop)) { returntrue; } +329if ("false".equalsIgnoreCase(prop)) { return false; } +330return defaultValue; +331 } +332 } +333 +334/** +335 * Returns the most appropriate logger. +336 * +337 * @return the logger for the plugin if available; otherwise the server +338 * logger. Never null. +339 */ +340privatestatic java.util.logging.Logger getBukkitLogger() { +341synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { +342return BukkitLoggerAdapter.BUKKIT_PLUGIN == null ? Bukkit.getLogger() +343 : BukkitLoggerAdapter.BUKKIT_PLUGIN.getLogger(); +344 } +345 } +346 +347/** +348 * Returns the map of logging levels to colors, taken from the Bukkit plugin +349 * config. For each relevant entry in the plugin config, if either the key +350 * name or the value name is invalid, that entry is ignored and the default +351 * value is used instead. +352 * +353 * @param property +354 * the config property where the map exists. +355 * @param defaultValue +356 * the fallback values returned by this method. +357 * @return never null, always contains one mapping for each {@link Level}, and +358 * contains no null keys/values. Equal to {@code defaultValue} if the +359 * Bukkit plugin is not available, or if the desired property is not +360 * defined in the config. +361 */ +362privatestatic Map<Level, ColorMarker> +363 getLevelColorsMap(final String property, +364final Map<Level, ColorMarker> defaultValues) { +365synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { +366// Check for the plugin. +367if (BukkitLoggerAdapter.BUKKIT_PLUGIN == null) { return defaultValues; } +368final ConfigurationSection config = BukkitLoggerAdapter.BUKKIT_PLUGIN.getConfig() +369 .getConfigurationSection(property); +370// Quit if the config isn't specified. +371if (config == null) { return defaultValues; } +372// Translate each portion of the config. Skip invalid keys/values. +373final Map<String, Object> configValues = config.getValues(false); +374final Map<Level, ColorMarker> convertedConfigValues = new HashMap<Level, ColorMarker>(); +375for (final Map.Entry<String, Object> configValue : configValues.entrySet()) { +376final String levelName = configValue.getKey().toUpperCase(); +377final String formatName = configValue.getValue().toString() +378 .toUpperCase(); +379 Level level; +380ColorMarker format; +381try { +382 level = Level.valueOf(levelName); +383 format = ColorMarker.valueOf(formatName); +384 } catch (final IllegalArgumentException e) { +385// This is expected, so don't log it. +386continue; +387 } +388 convertedConfigValues.put(level, format); +389 } +390// Merge the default and config-based map; the latter takes priority. +391final Map<Level, ColorMarker> finalConfigValues = new HashMap<Level, ColorMarker>(); +392 finalConfigValues.putAll(defaultValues); +393 finalConfigValues.putAll(convertedConfigValues); +394// Done; cast as immutable. +395return ImmutableMap.<Level, ColorMarker> builder() +396 .putAll(finalConfigValues).build(); +397 } +398 } +399 +400/** +401 * Returns a string property from the Bukkit plugin config. +402 * +403 * @param name +404 * the desired property. +405 * @param defaultValue +406 * the fallback value returned by this method. +407 * @return {@code defaultValue} if the Bukkit plugin is not available, or if +408 * the desired property is not defined in the config. +409 */ +410privatestatic String getStringProperty(final String name, +411final String defaultValue) { +412synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { +413if (BukkitLoggerAdapter.BUKKIT_PLUGIN == null) { return defaultValue; } +414final String prop = BukkitLoggerAdapter.BUKKIT_PLUGIN.getConfig() +415 .getString(name); +416return (prop == null) ? defaultValue : prop; +417 } +418 } +419 +420/** +421 * Converts an SLF4J logging level to a Bukkit logging level. +422 * +423 * <ul> +424 * <li>{@link Level#ERROR} maps to {@link java.util.logging.Level#SEVERE}.</li> +425 * <li>{@link Level#WARN} maps to {@link java.util.logging.Level#WARNING}.</li> +426 * <li>All others map to {@link java.util.logging.Level#INFO} (Bukkit won't +427 * log any messages higher than {@code INFO}).</li> +428 * </ul> +429 * +430 * @param slf4jLevel +431 * any SLF4J logging level. +432 * @return never null. +433 */ +434privatestatic java.util.logging.Level +435 slf4jLevelIntToBukkitJULLevel(final Level slf4jLevel) { +436 java.util.logging.Level julLevel; +437switch (slf4jLevel) { +438case ERROR: +439 julLevel = java.util.logging.Level.SEVERE; +440break; +441case WARN: +442 julLevel = java.util.logging.Level.WARNING; +443break; +444default: +445// In Bukkit, Only the SEVERE, WARNING and INFO JUL levels are enabled, +446// so SLF4J's TRACE and DEBUG levels must be logged at Bukkit's INFO +447// level. +448 julLevel = java.util.logging.Level.INFO; +449break; +450 } +451return julLevel; +452 } +453 +454/** +455 * Convert YAML logging level properties to SLF4J level objects. +456 * +457 * @param levelStr +458 * the level property value from the YAML config. +459 * @return null iff the input does not map to a SLF4J logging level name in a +460 * case-insensitive fashion. +461 */ +462privatestatic Level stringToLevel(final String levelStr) { +463if ("trace".equalsIgnoreCase(levelStr)) { +464return Level.TRACE; +465 } elseif ("debug".equalsIgnoreCase(levelStr)) { +466return Level.DEBUG; +467 } elseif ("info".equalsIgnoreCase(levelStr)) { +468return Level.INFO; +469 } elseif ("warn".equalsIgnoreCase(levelStr)) { +470return Level.WARN; +471 } elseif ("error".equalsIgnoreCase(levelStr)) { +472return Level.ERROR; +473 } else { +474returnnull; +475 } +476 } +477 +478 @Override +479publicvoid debug(final Marker marker, final String msg) { +480if (!this.isDebugEnabled()) { return; } +481this.log(Level.DEBUG, marker, msg, null); +482 } +483 +484 @Override +485publicvoid debug(final Marker marker, final String format, final Object arg) { +486if (!this.isDebugEnabled()) { return; } +487this.formatAndLog(Level.DEBUG, marker, format, arg, null); +488 } +489 +490 @Override +491publicvoid debug(final Marker marker, final String format, +492final Object... arguments) { +493if (!this.isDebugEnabled()) { return; } +494this.formatAndLog(Level.DEBUG, marker, format, arguments); +495 } +496 +497 @Override +498publicvoid debug(final Marker marker, final String format, +499final Object arg1, final Object arg2) { +500if (!this.isDebugEnabled()) { return; } +501this.formatAndLog(Level.DEBUG, marker, format, arg1, arg2); +502 } +503 +504 @Override +505publicvoid debug(final Marker marker, final String msg, final Throwable t) { +506if (!this.isDebugEnabled()) { return; } +507this.log(Level.DEBUG, marker, msg, t); +508 } +509 +510 @Override +511publicvoid debug(final String msg) { +512if (!this.isDebugEnabled()) { return; } +513this.log(Level.DEBUG, null, msg, null); +514 } +515 +516 @Override +517publicvoid debug(final String format, final Object arg) { +518if (!this.isDebugEnabled()) { return; } +519this.formatAndLog(Level.DEBUG, null, format, arg, null); +520 } +521 +522 @Override +523publicvoid debug(final String format, final Object... arguments) { +524if (!this.isDebugEnabled()) { return; } +525this.formatAndLog(Level.DEBUG, null, format, arguments); +526 } +527 +528 @Override +529publicvoid debug(final String format, final Object arg1, final Object arg2) { +530if (!this.isDebugEnabled()) { return; } +531this.formatAndLog(Level.DEBUG, null, format, arg1, arg2); +532 } +533 +534 @Override +535publicvoid debug(final String msg, final Throwable t) { +536if (!this.isDebugEnabled()) { return; } +537this.log(Level.DEBUG, null, msg, t); +538 } +539 +540 @Override +541publicvoid error(final Marker marker, final String msg) { +542if (!this.isErrorEnabled()) { return; } +543this.log(Level.ERROR, marker, msg, null); +544 } +545 +546 @Override +547publicvoid error(final Marker marker, final String format, final Object arg) { +548if (!this.isErrorEnabled()) { return; } +549this.formatAndLog(Level.ERROR, marker, format, arg, null); +550 } +551 +552 @Override +553publicvoid error(final Marker marker, final String format, +554final Object... arguments) { +555if (!this.isErrorEnabled()) { return; } +556this.formatAndLog(Level.ERROR, marker, format, arguments); +557 } +558 +559 @Override +560publicvoid error(final Marker marker, final String format, +561final Object arg1, final Object arg2) { +562if (!this.isErrorEnabled()) { return; } +563this.formatAndLog(Level.ERROR, marker, format, arg1, arg2); +564 } +565 +566 @Override +567publicvoid error(final Marker marker, final String msg, final Throwable t) { +568if (!this.isErrorEnabled()) { return; } +569this.log(Level.ERROR, marker, msg, t); +570 } +571 +572 @Override +573publicvoid error(final String msg) { +574if (!this.isErrorEnabled()) { return; } +575this.log(Level.ERROR, null, msg, null); +576 } +577 +578 @Override +579publicvoid error(final String format, final Object arg) { +580if (!this.isErrorEnabled()) { return; } +581this.formatAndLog(Level.ERROR, null, format, arg, null); +582 } +583 +584 @Override +585publicvoid error(final String format, final Object... arguments) { +586if (!this.isErrorEnabled()) { return; } +587this.formatAndLog(Level.ERROR, null, format, arguments); +588 } +589 +590 @Override +591publicvoid error(final String format, final Object arg1, final Object arg2) { +592if (!this.isErrorEnabled()) { return; } +593this.formatAndLog(Level.ERROR, null, format, arg1, arg2); +594 } +595 +596 @Override +597publicvoid error(final String msg, final Throwable t) { +598if (!this.isErrorEnabled()) { return; } +599this.log(Level.ERROR, null, msg, t); +600 } +601 +602 @Override +603public String getName() { +604returnthis.name; +605 } +606 +607 @Override +608publicvoid info(final Marker marker, final String msg) { +609if (!this.isInfoEnabled()) { return; } +610this.log(Level.INFO, marker, msg, null); +611 } +612 +613 @Override +614publicvoid info(final Marker marker, final String format, final Object arg) { +615if (!this.isInfoEnabled()) { return; } +616this.formatAndLog(Level.INFO, marker, format, arg, null); +617 } +618 +619 @Override +620publicvoid info(final Marker marker, final String format, +621final Object... arguments) { +622if (!this.isInfoEnabled()) { return; } +623this.formatAndLog(Level.INFO, marker, format, arguments); +624 } +625 +626 @Override +627publicvoid info(final Marker marker, final String format, final Object arg1, +628final Object arg2) { +629if (!this.isInfoEnabled()) { return; } +630this.formatAndLog(Level.INFO, marker, format, arg1, arg2); +631 } +632 +633 @Override +634publicvoid info(final Marker marker, final String msg, final Throwable t) { +635if (!this.isInfoEnabled()) { return; } +636this.log(Level.INFO, marker, msg, t); +637 } +638 +639 @Override +640publicvoid info(final String msg) { +641if (!this.isInfoEnabled()) { return; } +642this.log(Level.INFO, null, msg, null); +643 } +644 +645 @Override +646publicvoid info(final String format, final Object arg) { +647if (!this.isInfoEnabled()) { return; } +648this.formatAndLog(Level.INFO, null, format, arg, null); +649 } +650 +651 @Override +652publicvoid info(final String format, final Object... arguments) { +653if (!this.isInfoEnabled()) { return; } +654this.formatAndLog(Level.INFO, null, format, arguments); +655 } +656 +657 @Override +658publicvoid info(final String format, final Object arg1, final Object arg2) { +659if (!this.isInfoEnabled()) { return; } +660this.formatAndLog(Level.INFO, null, format, arg1, arg2); +661 } +662 +663 @Override +664publicvoid info(final String msg, final Throwable t) { +665if (!this.isInfoEnabled()) { return; } +666this.log(Level.INFO, null, msg, t); +667 } +668 +669 @Override +670publicboolean isDebugEnabled() { +671returnthis.isLevelEnabled(Level.DEBUG); +672 } +673 +674 @Override +675publicboolean isDebugEnabled(final Marker marker) { +676returnthis.isLevelEnabled(Level.DEBUG); +677 } +678 +679 @Override +680publicboolean isErrorEnabled() { +681returnthis.isLevelEnabled(Level.ERROR); +682 } +683 +684 @Override +685publicboolean isErrorEnabled(final Marker marker) { +686returnthis.isLevelEnabled(Level.ERROR); +687 } +688 +689 @Override +690publicboolean isInfoEnabled() { +691returnthis.isLevelEnabled(Level.INFO); +692 } +693 +694 @Override +695publicboolean isInfoEnabled(final Marker marker) { +696returnthis.isLevelEnabled(Level.INFO); +697 } +698 +699 @Override +700publicboolean isTraceEnabled() { +701returnthis.isLevelEnabled(Level.TRACE); +702 } +703 +704 @Override +705publicboolean isTraceEnabled(final Marker marker) { +706returnthis.isLevelEnabled(Level.TRACE); +707 } +708 +709 @Override +710publicboolean isWarnEnabled() { +711returnthis.isLevelEnabled(Level.WARN); +712 } +713 +714 @Override +715publicboolean isWarnEnabled(final Marker marker) { +716returnthis.isLevelEnabled(Level.WARN); +717 } +718 +719 @Override +720publicvoid trace(final Marker marker, final String msg) { +721if (!this.isTraceEnabled()) { return; } +722this.log(Level.TRACE, marker, msg, null); +723 } +724 +725 @Override +726publicvoid trace(final Marker marker, final String format, final Object arg) { +727if (!this.isTraceEnabled()) { return; } +728this.formatAndLog(Level.TRACE, marker, format, arg, null); +729 } +730 +731 @Override +732publicvoid trace(final Marker marker, final String format, +733final Object... arguments) { +734if (!this.isTraceEnabled()) { return; } +735this.formatAndLog(Level.TRACE, marker, format, arguments); +736 } +737 +738 @Override +739publicvoid trace(final Marker marker, final String format, +740final Object arg1, final Object arg2) { +741if (!this.isTraceEnabled()) { return; } +742this.formatAndLog(Level.TRACE, marker, format, arg1, arg2); +743 } +744 +745 @Override +746publicvoid trace(final Marker marker, final String msg, final Throwable t) { +747if (!this.isTraceEnabled()) { return; } +748this.log(Level.TRACE, marker, msg, t); +749 } +750 +751 @Override +752publicvoid trace(final String msg) { +753if (!this.isTraceEnabled()) { return; } +754this.log(Level.TRACE, null, msg, null); +755 } +756 +757 @Override +758publicvoid trace(final String format, final Object arg) { +759if (!this.isTraceEnabled()) { return; } +760this.formatAndLog(Level.TRACE, null, format, arg, null); +761 } +762 +763 @Override +764publicvoid trace(final String format, final Object... arguments) { +765if (!this.isTraceEnabled()) { return; } +766this.formatAndLog(Level.TRACE, null, format, arguments); +767 } +768 +769 @Override +770publicvoid trace(final String format, final Object arg1, final Object arg2) { +771if (!this.isTraceEnabled()) { return; } +772this.formatAndLog(Level.TRACE, null, format, arg1, arg2); +773 } +774 +775 @Override +776publicvoid trace(final String msg, final Throwable t) { +777if (!this.isTraceEnabled()) { return; } +778this.log(Level.TRACE, null, msg, t); +779 } +780 +781 @Override +782publicvoid warn(final Marker marker, final String msg) { +783if (!this.isWarnEnabled()) { return; } +784this.log(Level.WARN, marker, msg, null); +785 } +786 +787 @Override +788publicvoid warn(final Marker marker, final String format, final Object arg) { +789if (!this.isWarnEnabled()) { return; } +790this.formatAndLog(Level.WARN, marker, format, arg, null); +791 } +792 +793 @Override +794publicvoid warn(final Marker marker, final String format, +795final Object... arguments) { +796if (!this.isWarnEnabled()) { return; } +797this.formatAndLog(Level.WARN, marker, format, arguments); +798 } +799 +800 @Override +801publicvoid warn(final Marker marker, final String format, final Object arg1, +802final Object arg2) { +803if (!this.isWarnEnabled()) { return; } +804this.formatAndLog(Level.WARN, marker, format, arg1, arg2); +805 } +806 +807 @Override +808publicvoid warn(final Marker marker, final String msg, final Throwable t) { +809if (!this.isWarnEnabled()) { return; } +810this.log(Level.WARN, marker, msg, t); +811 } +812 +813 @Override +814publicvoid warn(final String msg) { +815if (!this.isWarnEnabled()) { return; } +816this.log(Level.WARN, null, msg, null); +817 } +818 +819 @Override +820publicvoid warn(final String format, final Object arg) { +821if (!this.isWarnEnabled()) { return; } +822this.formatAndLog(Level.WARN, null, format, arg, null); +823 } +824 +825 @Override +826publicvoid warn(final String format, final Object... arguments) { +827if (!this.isWarnEnabled()) { return; } +828this.formatAndLog(Level.WARN, null, format, arguments); +829 } +830 +831 @Override +832publicvoid warn(final String format, final Object arg1, final Object arg2) { +833if (!this.isWarnEnabled()) { return; } +834this.formatAndLog(Level.WARN, null, format, arg1, arg2); +835 } +836 +837 @Override +838publicvoid warn(final String msg, final Throwable t) { +839if (!this.isWarnEnabled()) { return; } +840this.log(Level.WARN, null, msg, t); +841 } +842 +843/** +844 * Computes this logger's short name, which is equivalent to the short Java +845 * package name format (e.g. a logger named "info.ronjenkins.bukkit.MyPlugin" +846 * would have a short name of "i.r.b.MyPlugin"). +847 * +848 * @return never null. +849 */ +850private String computeShortName() { +851final List<String> splitName = new ArrayList<String>(); +852 splitName.addAll(Arrays.asList(this.name.split("\\."))); +853finalint shortNameLength = ((splitName.size() - 1) * 2) +854 + splitName.get(splitName.size() - 1).length(); +855final String finalName = splitName.remove(splitName.size() - 1); +856final StringBuffer shortName = new StringBuffer(shortNameLength); +857for (final String part : splitName) { +858 shortName.append(part.charAt(0)).append('.'); +859 } +860 shortName.append(finalName); +861return shortName.toString(); +862 } +863 +864/** +865 * Computes this logger's current logging level, based on the Bukkit plugin +866 * config. +867 * +868 * @return the value of "slf4j.defaultLogLevel" if neither this logger nor any +869 * of its ancestors define a logging level. +870 */ +871private Level determineCurrentLevel() { +872// Compute the current level, which may be null. +873 String tempName = this.name; +874 Level level = null; +875int indexOfLastDot = tempName.length(); +876while ((level == null) && (indexOfLastDot > -1)) { +877 tempName = tempName.substring(0, indexOfLastDot); +878 level = BukkitLoggerAdapter.stringToLevel(BukkitLoggerAdapter.getStringProperty(BukkitLoggerAdapter.CONFIG_KEY_PREFIX_LOG +879 + tempName, +880null)); +881 indexOfLastDot = String.valueOf(tempName).lastIndexOf("."); +882 } +883// Return the default value if we got null. +884return (level == null) ? BukkitLoggerAdapter.CONFIG_VALUE_DEFAULT_LOG_LEVEL +885 : level; +886 } +887 +888/** +889 * For formatted messages, first substitute arguments and then log. +890 * +891 * @param level +892 * the level of this message. +893 * @param marker +894 * the marker to use for this message, may be null. +895 * @param format +896 * the message format string. +897 * @param arguments +898 * 3 or more arguments. +899 */ +900privatevoid formatAndLog(final Level level, final Marker marker, +901final String format, final Object... arguments) { +902if (!this.isLevelEnabled(level)) { return; } +903final FormattingTuple tp = MessageFormatter.arrayFormat(format, arguments); +904this.log(level, marker, tp.getMessage(), tp.getThrowable()); +905 } +906 +907/** +908 * For formatted messages, first substitute arguments and then log. +909 * +910 * @param level +911 * the level of this message. +912 * @param marker +913 * the marker to use for this message, may be null. +914 * @param format +915 * the message format string. +916 * @param arg1 +917 * format argument #1. +918 * @param arg2 +919 * format argument #2. +920 */ +921privatevoid formatAndLog(final Level level, final Marker marker, +922final String format, final Object arg1, +923final Object arg2) { +924if (!this.isLevelEnabled(level)) { return; } +925final FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); +926this.log(level, marker, tp.getMessage(), tp.getThrowable()); +927 } +928 +929/** +930 * Is the given log level currently enabled? +931 * +932 * @param logLevel +933 * is this level enabled? +934 * @return true if enabled, false if disabled. +935 */ +936privateboolean isLevelEnabled(final Level logLevel) { +937// Ensure that SLF4Bukkit is initialized. Every public API call passes +938// through this method, so this is the appropriate place to ensure +939// initialization. +940 BukkitLoggerAdapter.init(false); +941// log level are numerically ordered so can use simple numeric comparison +942// +943// the PLUGIN.getLogger().isLoggable() check avoids the unconditional +944// construction of location data for disabled log statements. As of +945// 2008-07-31, callers of this method do not perform this check. See also +946// http://jira.qos.ch/browse/SLF4J-81 +947final Level currentLogLevel = this.determineCurrentLevel(); +948return (logLevel.toInt() >= currentLogLevel.toInt()) +949 && (BukkitLoggerAdapter.getBukkitLogger().isLoggable(BukkitLoggerAdapter.slf4jLevelIntToBukkitJULLevel(logLevel))); +950 } +951 +952/** +953 * Assembles the final log message and sends it to the appropriate Bukkit +954 * logger. +955 * +956 * @param level +957 * the desired log level of the message. +958 * @param marker +959 * the marker to use for this message, may be null. +960 * @param message +961 * the message to be logged. +962 * @param throwable +963 * the exception to be logged, may be null. +964 */ +965privatevoid log(final Level level, final Marker marker, +966final String message, final Throwable throwable) { +967final java.util.logging.Logger logger; +968synchronized (BukkitLoggerAdapter.INITIALIZATION_LOCK) { +969// Ensure that the logger will accept this request. +970if (!this.isLevelEnabled(level)) { return; } +971// Determine which logger will be used. +972 logger = BukkitLoggerAdapter.getBukkitLogger(); +973 } +974 +975// Start building the log message. +976final StringBuilder buf = new StringBuilder(32); +977boolean hasHeader = false; +978 +979// Use the marker, if applicable. Otherwise, use the default color for +980// this level. +981if (marker instanceof ColorMarker) { +982 buf.append(((ColorMarker) marker).getValue()); +983 } else { +984 buf.append(BukkitLoggerAdapter.CONFIG_VALUE_LEVEL_COLORS.get(level) +985 .getValue()); +986 } +987 +988// Indicate that this message comes from SLF4J, if desired. +989if (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_HEADER) { +990 hasHeader = true; +991 buf.append("[SLF4J]"); +992 } +993 +994// Print a readable representation of the log level, but only for log levels +995// that Bukkit would otherwise eat. +996switch (level) { +997case TRACE: +998 hasHeader = true; +999 buf.append("[TRACE]"); +1000break; +1001case DEBUG: +1002 hasHeader = true; +1003 buf.append("[DEBUG]"); +1004break; +1005default: +1006break; +1007 } +1008 +1009// Append the current thread name, if desired. +1010if (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_THREAD_NAME) { +1011 hasHeader = true; +1012 buf.append('['); +1013 buf.append(Thread.currentThread().getName()); +1014 buf.append("]"); +1015 } +1016 +1017// Buffer the current output with a space, unless there is no output. +1018if (hasHeader) { +1019 buf.append(' '); +1020 } +1021 +1022// Append the name of the log instance, if desired. +1023if (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_LOG_NAME) { +1024 buf.append('{').append(this.name).append("} "); +1025 } elseif (BukkitLoggerAdapter.CONFIG_VALUE_SHOW_SHORT_LOG_NAME) { +1026if (this.shortLogName == null) { +1027this.shortLogName = this.computeShortName(); +1028 } +1029 buf.append('{').append(this.shortLogName).append("} "); +1030 } +1031 +1032// Append the message. +1033 buf.append(message); +1034 +1035// Append the throwable, if applicable. +1036if (throwable != null) { +1037 buf.append('\n').append(ExceptionUtils.getFullStackTrace(throwable) +1038 .trim()); +1039 } +1040 +1041// Append a reset directive. +1042 buf.append(ChatColor.RESET); +1043 +1044// Log the message. +1045 logger.log(BukkitLoggerAdapter.slf4jLevelIntToBukkitJULLevel(level), +1046 ColorMapper.map(buf.toString())); +1047 } +1048 }
    diff --git a/xref/org/slf4j/impl/package-frame.html b/xref/org/slf4j/impl/package-frame.html index a9e4a8b..3459c8e 100644 --- a/xref/org/slf4j/impl/package-frame.html +++ b/xref/org/slf4j/impl/package-frame.html @@ -3,7 +3,7 @@ - SLF4Bukkit 0.1.3 Reference Package org.slf4j.impl + SLF4Bukkit 0.1.4 Reference Package org.slf4j.impl diff --git a/xref/org/slf4j/impl/package-summary.html b/xref/org/slf4j/impl/package-summary.html index 1735969..ffd74b7 100644 --- a/xref/org/slf4j/impl/package-summary.html +++ b/xref/org/slf4j/impl/package-summary.html @@ -3,7 +3,7 @@ - SLF4Bukkit 0.1.3 Reference Package org.slf4j.impl + SLF4Bukkit 0.1.4 Reference Package org.slf4j.impl diff --git a/xref/overview-frame.html b/xref/overview-frame.html index 9e3bad1..2469cde 100644 --- a/xref/overview-frame.html +++ b/xref/overview-frame.html @@ -3,7 +3,7 @@ - SLF4Bukkit 0.1.3 Reference + SLF4Bukkit 0.1.4 Reference diff --git a/xref/overview-summary.html b/xref/overview-summary.html index 9a5bf99..05b8539 100644 --- a/xref/overview-summary.html +++ b/xref/overview-summary.html @@ -3,7 +3,7 @@ - SLF4Bukkit 0.1.3 Reference + SLF4Bukkit 0.1.4 Reference @@ -24,7 +24,7 @@ -

    SLF4Bukkit 0.1.3 Reference

    +

    SLF4Bukkit 0.1.4 Reference

    SLF4Bukkit
    slf4bukkit
    Version0.1.3
    0.1.4
    Type jar