Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
[logger] Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
pkriens committed Oct 3, 2016
1 parent a023e4c commit db86519
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
10 changes: 6 additions & 4 deletions osgi.enroute.logger.simple.provider/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ Export-Package: \
org.slf4j.helpers;version=1.7.0,\
org.slf4j;provide:=true;-split-package:=merge-last;version=1.7.0

Private-Package: \
Private-Package: \
osgi.enroute.logger.simple.provider,\
org.slf4j.impl;-split-package:=first,\
org.slf4j.spi
org.slf4j.spi,\
osgi.enroute.command.enroute.provider
Bundle-License: http://opensource.org/licenses/BSD-2-Clause
Import-Package: \
aQute.bnd.annotation.metatype;resolution:=optional,\
*
Conditional-Package: aQute.lib*

-buildpath: \
-buildpath: \
osgi.enroute.base.api;version=1.0;packages=*,\
biz.aQute.bndlib;packages=*
biz.aQute.bndlib;packages=*,\
org.apache.felix.gogo.runtime

-testpath: \
osgi.enroute.junit.wrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@
configurationPolicy = ConfigurationPolicy.OPTIONAL,
property = {
Debug.COMMAND_SCOPE + "=logger",
Debug.COMMAND_FUNCTION + "=add",
Debug.COMMAND_FUNCTION + "=remove",
Debug.COMMAND_FUNCTION + "=match",
Debug.COMMAND_FUNCTION + "=unmatch",
Debug.COMMAND_FUNCTION + "=settings",
Debug.COMMAND_FUNCTION + "=list",
Debug.COMMAND_FUNCTION + "=slf4j"
Debug.COMMAND_FUNCTION + "=loggers",
Debug.COMMAND_FUNCTION + "=slf4j",
Debug.COMMAND_FUNCTION + "=error",
Debug.COMMAND_FUNCTION + "=trace",
Debug.COMMAND_FUNCTION + "=warning",
Debug.COMMAND_FUNCTION + "=info"
})
// @formatter:on
public class LoggerAdminImpl extends Thread implements LoggerAdmin, Eval {
Expand Down Expand Up @@ -273,7 +277,11 @@ public void eval(AbstractLogger msf) {
return infos;
}

public List<Info> list() throws Exception {
public List<Info> loggers(String glob) throws Exception {
return list(glob);
}

public List<Info> loggers() throws Exception {
return list("*");
}

Expand Down Expand Up @@ -326,7 +334,7 @@ private void error(String string, Exception ee) {
* set of options: stacktrace, where
* @return the Control added
*/
public Control add(Glob pattern, String level, String... options) throws Exception {
public Control match(Glob pattern, String level, String... options) throws Exception {
Settings settings = getSettings();
Control control = new Control();
control.level = toLevel(level);
Expand Down Expand Up @@ -363,7 +371,7 @@ private Level toLevel(String level) throws Exception {
* exact pattern)
* @return the controls removed
*/
public List<Control> remove(Glob pattern) throws Exception {
public List<Control> unmatch(Glob pattern) throws Exception {
Settings settings = getSettings();
List<Control> deleted = new ArrayList<>();

Expand Down Expand Up @@ -449,4 +457,17 @@ void addLogService(LogService log) {
void removeLogService(LogService log) {
logs.remove(log);
}

public void error(String msg) {
logger.error(msg);
}
public void info(String msg) {
logger.info(msg);
}
public void trace(String msg) {
logger.trace(msg);
}
public void warning(String msg) {
logger.warn(msg);
}
}

0 comments on commit db86519

Please sign in to comment.