Skip to content

Commit

Permalink
FluentLogger: Support force logging
Browse files Browse the repository at this point in the history
RELNOTES=Add support for force logging

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208039454
  • Loading branch information
EdwinKempin authored and ronshapiro committed Aug 24, 2018
1 parent 12aea6a commit 9d3e001
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/src/main/java/com/google/common/flogger/FluentLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@ public static FluentLogger forEnclosingClass() {

@Override
public Api at(Level level) {
return isLoggable(level) ? new Context(level) : NO_OP;
boolean isLoggable = isLoggable(level);
boolean isForced = Platform.shouldForceLogging(getName(), level, isLoggable);
return (isLoggable || isForced) ? new Context(level, isForced) : NO_OP;
}

/** Logging context implementing the fully specified API for this logger. */
// VisibleForTesting
final class Context extends LogContext<FluentLogger, Api> implements Api {
private Context(Level level) {
super(level, false /* default fluent logger does not support 'forcing' yet */);
private Context(Level level, boolean isForced) {
super(level, isForced);
}

@Override
Expand Down

0 comments on commit 9d3e001

Please sign in to comment.