Skip to content

Commit 6b511fb

Browse files
author
Ben Creech
committed
Make LoggingHandler.logEntryFor extensible
1 parent 85b3ebd commit 6b511fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public void publish(LogRecord record) {
305305
}
306306
LogEntry logEntry;
307307
try {
308-
logEntry = logEntryFor(record);
308+
logEntry = logEntryFor(record).build();
309309
} catch (Exception ex) {
310310
getErrorManager().error(null, ex, ErrorManager.FORMAT_FAILURE);
311311
return;
@@ -343,7 +343,7 @@ private MonitoredResource getMonitoredResource() {
343343
return null;
344344
}
345345

346-
private LogEntry logEntryFor(LogRecord record) throws Exception {
346+
protected LogEntry.Builder logEntryFor(LogRecord record) throws Exception {
347347
String payload = getFormatter().format(record);
348348
Level level = record.getLevel();
349349
LogEntry.Builder builder =
@@ -360,7 +360,7 @@ private LogEntry logEntryFor(LogRecord record) throws Exception {
360360
for (LoggingEnhancer enhancer : enhancers) {
361361
enhancer.enhanceLogEntry(builder);
362362
}
363-
return builder.build();
363+
return builder;
364364
}
365365

366366
@Override

0 commit comments

Comments
 (0)