You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-12Lines changed: 33 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,27 +32,48 @@ Each component has a `filter` option allowing to restrict its functionality. It
32
32
*`com.example.test.Main`: includes all methods of a specific class
33
33
*`com.example.test.Main.dump()`: includes all methods with a particular name inside a class (empty parentheses at the end are mandatory)
34
34
35
-
## MethodLogger component
35
+
## Extended format strings
36
36
37
-
This component will add logging to the start of each method. In addition to the method signature, the parameter values will be logged.
37
+
Some components will allow specifying extended format strings for data to be logged. These use the usual [Java format specifiers](https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax) like `%s` or `%i` but require specifying the input as well, e.g. `{this:%s}` (format `this` value as a string) or `{arg2:%i}` (format second parameter as integer). The following input specifiers are possible:
38
+
39
+
*`method`: The signature of the calling method
40
+
*`result`: Call result if available
41
+
*`this`: Instance reference
42
+
*`argNN`: Argument value where NN is the argument’s zero-based position
43
+
44
+
In addition, the format specifier `%x` is treated specially: `System.identityHashCode()` will be called on the corresponding input and the result hex-formatted.
45
+
46
+
## CallLogger component
47
+
48
+
This component will add logging code after calls to specified methods. See `config.properties.downloads` for a configuration example logging `URLConnection` interactions.
38
49
39
50
Configuration options:
40
51
41
-
*`MethodLogger.enabled`: add to enable this component
42
-
*`MethodLogger.filter`: (optional) restricts functionality to a set of classes or methods (see Filters section above)
43
-
*`MethodLogger.tag`: (optional) log tag to be used (default is `MethodLogger`)
52
+
*`CallLogger.enabled`: add to enable this component
53
+
*`CallLogger.filter`: (optional) restricts functionality to a set of classes or methods (see Filters section above)
54
+
*`CallLogger.tag`: (optional) log tag to be used (default is `CallLogger`)
55
+
*`CallLogger.<class>:<method>`: specifies a call to be logged. `<class>` has to be a full class name like `java.net.URL`. `<method>` can be either a method name like `openConnection` or a more specific method name along with parameter types like `getHeaderField(java.lang.String)`. The value is a format string (see Extended format strings section above).
44
56
45
-
## DownloadLogger component
57
+
## StreamLogger component
46
58
47
-
This component will log `URLConnection` interactions.
59
+
This component will wrap `InputStream` and `OutputStream` instances returned by specified methods to log data being sent or received. See `config.properties.downloads` for a configuration example logging streams returned by `URLConnection.getInputStream()` and `URLConnection.getOutputStream()`.
48
60
49
61
Configuration options:
50
62
51
-
*`DownloadLogger.enabled`: add to enable this component
52
-
*`DownloadLogger.filter`: (optional) restricts functionality to a set of classes or methods (see Filters section above)
53
-
*`DownloadLogger.tag`: (optional) log tag to be used (default is `DownloadLogger`)
54
-
*`DownloadLogger.requestBodies`: (optional) if present, data sent via the connection will be logged
55
-
*`DownloadLogger.responses`: (optional) if present, data received via the connection will be logged
63
+
*`StreamLogger.enabled`: add to enable this component
64
+
*`StreamLogger.filter`: (optional) restricts functionality to a set of classes or methods (see Filters section above)
65
+
*`StreamLogger.tag`: (optional) log tag to be used (default is `StreamLogger`)
66
+
*`StreamLogger.<class>:<method>`: specifies a call returning a stream that should be wrapped. `<class>` has to be a full class name like `java.net.URLConnection`. `<method>` can be either a method name like `getInputStream` or a more specific method name along with parameter types like `getOutputStream(java.net.URL)`. The value is a format string that will be used as a prefix for logged data (see Extended format strings section above).
67
+
68
+
## MethodLogger component
69
+
70
+
This component will add logging to the start of each method. In addition to the method signature, the parameter values will be logged.
71
+
72
+
Configuration options:
73
+
74
+
*`MethodLogger.enabled`: add to enable this component
75
+
*`MethodLogger.filter`: (optional) restricts functionality to a set of classes or methods (see Filters section above)
76
+
*`MethodLogger.tag`: (optional) log tag to be used (default is `MethodLogger`)
0 commit comments