Skip to content

Commit 7dcb300

Browse files
Treiblesschorlegselzer
authored andcommitted
Add logger to op environment
1 parent 56348f7 commit 7dcb300

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/main/java/org/scijava/ops/OpEnvironment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import java.util.Collection;
3333

34+
import org.scijava.log.LogService;
3435
import org.scijava.ops.matcher.OpInfo;
3536
import org.scijava.ops.matcher.OpRef;
3637

@@ -68,4 +69,6 @@ public interface OpEnvironment {
6869
Iterable<OpInfo> infos();
6970

7071
Iterable<OpInfo> infos(String name);
72+
73+
LogService logger();
7174
}

src/main/java/org/scijava/ops/OpService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ public Iterable<OpInfo> infos(String name) {
157157
}
158158
return opCache.getAndBelow(new PrefixQuery(opName));
159159
}
160+
161+
@Override
162+
public LogService logger() {
163+
return log;
164+
}
160165

161166
@SuppressWarnings("unchecked")
162167
public <T> T findOpInstance(final String opName, final Nil<T> specialType, final Nil<?>[] inTypes,

src/main/java/org/scijava/ops/matcher/OpCandidate.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,8 @@ private void inject(StructInstance<?> opInst, Object... secondaryArgs) {
223223
Inject.Structs.inputs(opInst, paddedArgs);
224224
// Secondary args are given, however there are no to inject
225225
} else if (secondaryArgs.length > 0) {
226-
//TODO where get the logger from?
227-
// log.warn(
228-
// "Specified Op has no secondary args, however secondary args are given. "
229-
// + "The specified args will not be injected.");
226+
ops().logger().warn("Specified Op has no secondary args, however secondary args are given. "
227+
+ "The specified args will not be injected.");
230228
}
231229
}
232230
}

0 commit comments

Comments
 (0)