001package org.slf4j.event; 002 003import java.util.ArrayList; 004import java.util.Arrays; 005import java.util.List; 006 007import org.slf4j.Marker; 008import org.slf4j.helpers.SubstituteLogger; 009 010/** 011 * An implementation of {@link LoggingEvent} used to store logging events generated during logging backend 012 * initialization. 013 * 014 * @author Ceki Gülcü 015 * @since 1.7.15 016 */ 017public class SubstituteLoggingEvent implements LoggingEvent { 018 019 Level level; 020 List<Marker> markers; 021 String loggerName; 022 SubstituteLogger logger; 023 String threadName; 024 String message; 025 Object[] argArray; 026 List<KeyValuePair> keyValuePairList; 027 028 long timeStamp; 029 Throwable throwable; 030 031 public Level getLevel() { 032 return level; 033 } 034 035 public void setLevel(Level level) { 036 this.level = level; 037 } 038 039 public List<Marker> getMarkers() { 040 return markers; 041 } 042 043 public void addMarker(Marker marker) { 044 if (marker == null) 045 return; 046 047 if (markers == null) { 048 markers = new ArrayList<>(2); 049 } 050 051 markers.add(marker); 052 } 053 054 public String getLoggerName() { 055 return loggerName; 056 } 057 058 public void setLoggerName(String loggerName) { 059 this.loggerName = loggerName; 060 } 061 062 public SubstituteLogger getLogger() { 063 return logger; 064 } 065 066 public void setLogger(SubstituteLogger logger) { 067 this.logger = logger; 068 } 069 070 public String getMessage() { 071 return message; 072 } 073 074 public void setMessage(String message) { 075 this.message = message; 076 } 077 078 public Object[] getArgumentArray() { 079 return argArray; 080 } 081 082 public void setArgumentArray(Object[] argArray) { 083 this.argArray = argArray; 084 } 085 086 @Override 087 public List<Object> getArguments() { 088 if (argArray == null) { 089 return null; 090 } 091 return Arrays.asList(argArray); 092 } 093 094 public long getTimeStamp() { 095 return timeStamp; 096 } 097 098 public void setTimeStamp(long timeStamp) { 099 this.timeStamp = timeStamp; 100 } 101 102 public String getThreadName() { 103 return threadName; 104 } 105 106 public void setThreadName(String threadName) { 107 this.threadName = threadName; 108 } 109 110 public Throwable getThrowable() { 111 return throwable; 112 } 113 114 public void setThrowable(Throwable throwable) { 115 this.throwable = throwable; 116 } 117 118 @Override 119 public List<KeyValuePair> getKeyValuePairs() { 120 return keyValuePairList; 121 } 122}