@@ -9,7 +9,11 @@ import com.squareup.workflow1.WorkflowInterceptor.WorkflowSession
9
9
import kotlin.reflect.KClass
10
10
import kotlin.reflect.KType
11
11
12
- internal fun WorkflowSession.toWfLoggingName (): String {
12
+ /* *
13
+ * Short name that can be used for logs that has the [identifier] logged as well
14
+ * as the key.
15
+ */
16
+ public fun WorkflowSession.toWfLoggingName (): String {
13
17
val renderKey = renderKey
14
18
return if (renderKey.isEmpty()) {
15
19
identifier.toWfLoggingName()
@@ -18,7 +22,11 @@ internal fun WorkflowSession.toWfLoggingName(): String {
18
22
}
19
23
}
20
24
21
- internal fun WorkflowIdentifier.toWfLoggingName (): String {
25
+ /* *
26
+ * Short name that for the identifier that can be used for logs. This reports
27
+ * the 'log name' of the class.
28
+ */
29
+ public fun WorkflowIdentifier.toWfLoggingName (): String {
22
30
return when (val type = realType) {
23
31
is Snapshottable -> type.kClass?.toWfLoggingName() ? : type.typeName
24
32
is Unsnapshottable -> type.kType.toWfLoggingName()
@@ -55,7 +63,10 @@ public fun String.workerKey(): String {
55
63
}
56
64
}
57
65
58
- internal fun KType.toWfLoggingName (): String {
66
+ /* *
67
+ * Reasonable log name based on type.
68
+ */
69
+ public fun KType.toWfLoggingName (): String {
59
70
if (classifier == null ) return toString().wfStripSquarePackage()
60
71
61
72
val classifierName = when (val c = classifier) {
@@ -79,7 +90,7 @@ internal fun KType.toWfLoggingName(): String {
79
90
*
80
91
* For example, `java.util.Map` would be `Map`, and `java.util.Map.Entry` would be `Map.Entry`.
81
92
*/
82
- internal fun getWfHumanClassName (obj : Any ): String {
93
+ public fun getWfHumanClassName (obj : Any ): String {
83
94
val objClass: Class <* > = when (obj) {
84
95
is KClass <* > -> obj.java
85
96
is Class <* > -> obj
@@ -98,7 +109,10 @@ internal fun getWfHumanClassName(obj: Any): String {
98
109
return humanName
99
110
}
100
111
101
- internal fun KClass <* >.toWfLoggingName (): String {
112
+ /* *
113
+ * Reasonable class name based on type.
114
+ */
115
+ public fun KClass <* >.toWfLoggingName (): String {
102
116
return getWfHumanClassName(this )
103
117
}
104
118
@@ -134,7 +148,7 @@ public fun getWfLogString(log: Any?): String {
134
148
* @param maxLength The maximum length the string can be before ellipsizing will occur. This must be
135
149
* a positive number.
136
150
*/
137
- internal fun String.wfEllipsizeEnd (maxLength : Int ): String {
151
+ public fun String.wfEllipsizeEnd (maxLength : Int ): String {
138
152
require(maxLength > 0 )
139
153
140
154
return if (maxLength < length) {
@@ -147,7 +161,7 @@ internal fun String.wfEllipsizeEnd(maxLength: Int): String {
147
161
/* *
148
162
* Removes the string from kotlin.jvm.internal.Reflection#REFLECTION_NOT_AVAILABLE
149
163
*/
150
- internal fun String.wfRemoveReflectionNotAvailable () = replace(
164
+ public fun String.wfRemoveReflectionNotAvailable () = replace(
151
165
" (Kotlin reflection is not available)" ,
152
166
" "
153
167
)
@@ -158,7 +172,7 @@ internal fun String.wfRemoveReflectionNotAvailable() = replace(
158
172
*
159
173
* This will help make things more readable for classes within this library.
160
174
*/
161
- internal fun String.wfStripSquarePackage (): String {
175
+ public fun String.wfStripSquarePackage (): String {
162
176
// Find the index of every "com.squareup".
163
177
var cursor = 0
164
178
var packages: MutableList <Int >? = null
0 commit comments