Skip to content

Commit 01c9a6d

Browse files
committed
fix file formatting
1 parent cfb2b2d commit 01c9a6d

19 files changed

+831
-609
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
; Unix-style newlines with a newline ending every file
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
; Tab indentation (no size specified)
8+
indent_style = space
9+
charset = utf-8
10+
indent_size = 4
11+
Lines changed: 124 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,132 @@
11
package mu
22

33

4-
54
expect interface KLogger {
65

76

8-
/**
9-
* Lazy add a log message if isTraceEnabled is true
10-
*/
11-
fun trace(msg: () -> Any?)
12-
13-
/**
14-
* Lazy add a log message if isDebugEnabled is true
15-
*/
16-
fun debug(msg: () -> Any?)
17-
18-
/**
19-
* Lazy add a log message if isInfoEnabled is true
20-
*/
21-
fun info(msg: () -> Any?)
22-
23-
/**
24-
* Lazy add a log message if isWarnEnabled is true
25-
*/
26-
fun warn(msg: () -> Any?)
27-
28-
/**
29-
* Lazy add a log message if isErrorEnabled is true
30-
*/
31-
fun error(msg: () -> Any?)
32-
33-
/**
34-
* Lazy add a log message with throwable payload if isTraceEnabled is true
35-
*/
36-
fun trace(t: Throwable?, msg: () -> Any?)
37-
38-
/**
39-
* Lazy add a log message with throwable payload if isDebugEnabled is true
40-
*/
41-
fun debug(t: Throwable?, msg: () -> Any?)
42-
43-
/**
44-
* Lazy add a log message with throwable payload if isInfoEnabled is true
45-
*/
46-
fun info(t: Throwable?, msg: () -> Any?)
47-
48-
/**
49-
* Lazy add a log message with throwable payload if isWarnEnabled is true
50-
*/
51-
fun warn(t: Throwable?, msg: () -> Any?)
52-
53-
/**
54-
* Lazy add a log message with throwable payload if isErrorEnabled is true
55-
*/
56-
fun error(t: Throwable?, msg: () -> Any?)
57-
58-
/**
59-
* Lazy add a log message with a marker if isTraceEnabled is true
60-
*/
61-
fun trace(marker: Marker?, msg: () -> Any?)
62-
63-
/**
64-
* Lazy add a log message with a marker if isDebugEnabled is true
65-
*/
66-
fun debug(marker: Marker?, msg: () -> Any?)
67-
68-
/**
69-
* Lazy add a log message with a marker if isInfoEnabled is true
70-
*/
71-
fun info(marker: Marker?, msg: () -> Any?)
72-
73-
/**
74-
* Lazy add a log message with a marker if isWarnEnabled is true
75-
*/
76-
fun warn(marker: Marker?, msg: () -> Any?)
77-
78-
/**
79-
* Lazy add a log message with a marker if isErrorEnabled is true
80-
*/
81-
fun error(marker: Marker?, msg: () -> Any?)
82-
83-
/**
84-
* Lazy add a log message with a marker and throwable payload if isTraceEnabled is true
85-
*/
86-
fun trace(marker: Marker?, t: Throwable?, msg: () -> Any?)
87-
88-
/**
89-
* Lazy add a log message with a marker and throwable payload if isDebugEnabled is true
90-
*/
91-
fun debug(marker: Marker?, t: Throwable?, msg: () -> Any?)
92-
93-
/**
94-
* Lazy add a log message with a marker and throwable payload if isInfoEnabled is true
95-
*/
96-
fun info(marker: Marker?, t: Throwable?, msg: () -> Any?)
97-
98-
/**
99-
* Lazy add a log message with a marker and throwable payload if isWarnEnabled is true
100-
*/
101-
fun warn(marker: Marker?, t: Throwable?, msg: () -> Any?)
102-
103-
/**
104-
* Lazy add a log message with a marker and throwable payload if isErrorEnabled is true
105-
*/
106-
fun error(marker: Marker?, t: Throwable?, msg: () -> Any?)
107-
108-
/**
109-
* Add a log message with all the supplied parameters along with method name
110-
*/
111-
fun entry(vararg argArray: Any)
112-
113-
/**
114-
* Add log message indicating exit of a method
115-
*/
116-
fun exit()
117-
118-
/**
119-
* Add a log message with the return value of a method
120-
*/
121-
fun <T> exit(retval: T?): T? where T : Any
122-
123-
/**
124-
* Add a log message indicating an exception will be thrown along with the stack trace.
125-
*/
126-
fun <T> throwing(throwable: T): T where T : Throwable
127-
128-
/**
129-
* Add a log message indicating an exception is caught along with the stack trace.
130-
*/
131-
fun <T> catching(throwable: T) where T : Throwable
7+
/**
8+
* Lazy add a log message if isTraceEnabled is true
9+
*/
10+
fun trace(msg: () -> Any?)
11+
12+
/**
13+
* Lazy add a log message if isDebugEnabled is true
14+
*/
15+
fun debug(msg: () -> Any?)
16+
17+
/**
18+
* Lazy add a log message if isInfoEnabled is true
19+
*/
20+
fun info(msg: () -> Any?)
21+
22+
/**
23+
* Lazy add a log message if isWarnEnabled is true
24+
*/
25+
fun warn(msg: () -> Any?)
26+
27+
/**
28+
* Lazy add a log message if isErrorEnabled is true
29+
*/
30+
fun error(msg: () -> Any?)
31+
32+
/**
33+
* Lazy add a log message with throwable payload if isTraceEnabled is true
34+
*/
35+
fun trace(t: Throwable?, msg: () -> Any?)
36+
37+
/**
38+
* Lazy add a log message with throwable payload if isDebugEnabled is true
39+
*/
40+
fun debug(t: Throwable?, msg: () -> Any?)
41+
42+
/**
43+
* Lazy add a log message with throwable payload if isInfoEnabled is true
44+
*/
45+
fun info(t: Throwable?, msg: () -> Any?)
46+
47+
/**
48+
* Lazy add a log message with throwable payload if isWarnEnabled is true
49+
*/
50+
fun warn(t: Throwable?, msg: () -> Any?)
51+
52+
/**
53+
* Lazy add a log message with throwable payload if isErrorEnabled is true
54+
*/
55+
fun error(t: Throwable?, msg: () -> Any?)
56+
57+
/**
58+
* Lazy add a log message with a marker if isTraceEnabled is true
59+
*/
60+
fun trace(marker: Marker?, msg: () -> Any?)
61+
62+
/**
63+
* Lazy add a log message with a marker if isDebugEnabled is true
64+
*/
65+
fun debug(marker: Marker?, msg: () -> Any?)
66+
67+
/**
68+
* Lazy add a log message with a marker if isInfoEnabled is true
69+
*/
70+
fun info(marker: Marker?, msg: () -> Any?)
71+
72+
/**
73+
* Lazy add a log message with a marker if isWarnEnabled is true
74+
*/
75+
fun warn(marker: Marker?, msg: () -> Any?)
76+
77+
/**
78+
* Lazy add a log message with a marker if isErrorEnabled is true
79+
*/
80+
fun error(marker: Marker?, msg: () -> Any?)
81+
82+
/**
83+
* Lazy add a log message with a marker and throwable payload if isTraceEnabled is true
84+
*/
85+
fun trace(marker: Marker?, t: Throwable?, msg: () -> Any?)
86+
87+
/**
88+
* Lazy add a log message with a marker and throwable payload if isDebugEnabled is true
89+
*/
90+
fun debug(marker: Marker?, t: Throwable?, msg: () -> Any?)
91+
92+
/**
93+
* Lazy add a log message with a marker and throwable payload if isInfoEnabled is true
94+
*/
95+
fun info(marker: Marker?, t: Throwable?, msg: () -> Any?)
96+
97+
/**
98+
* Lazy add a log message with a marker and throwable payload if isWarnEnabled is true
99+
*/
100+
fun warn(marker: Marker?, t: Throwable?, msg: () -> Any?)
101+
102+
/**
103+
* Lazy add a log message with a marker and throwable payload if isErrorEnabled is true
104+
*/
105+
fun error(marker: Marker?, t: Throwable?, msg: () -> Any?)
106+
107+
/**
108+
* Add a log message with all the supplied parameters along with method name
109+
*/
110+
fun entry(vararg argArray: Any)
111+
112+
/**
113+
* Add log message indicating exit of a method
114+
*/
115+
fun exit()
116+
117+
/**
118+
* Add a log message with the return value of a method
119+
*/
120+
fun <T> exit(retval: T?): T? where T : Any
121+
122+
/**
123+
* Add a log message indicating an exception will be thrown along with the stack trace.
124+
*/
125+
fun <T> throwing(throwable: T): T where T : Throwable
126+
127+
/**
128+
* Add a log message indicating an exception is caught along with the stack trace.
129+
*/
130+
fun <T> catching(throwable: T) where T : Throwable
132131

133132
}

src/commonMain/kotlin/mu/KotlinLogging.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mu
22

33

4-
54
expect object KotlinLogging {
65
/**
76
* This method allow defining the logger in a file in the following way:

src/jsMain/kotlin/mu/DefaultMessageFormatter.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ import mu.internal.toStringSafe
44

55
object DefaultMessageFormatter : Formatter {
66
override fun formatMessage(level: KotlinLoggingLevel, loggerName: String, msg: () -> Any?) =
7-
"${level.name}: [$loggerName] ${msg.toStringSafe()}"
7+
"${level.name}: [$loggerName] ${msg.toStringSafe()}"
88

99
override fun formatMessage(level: KotlinLoggingLevel, loggerName: String, t: Throwable?, msg: () -> Any?) =
10-
"${level.name}: [$loggerName] ${msg.toStringSafe()}${t.throwableToString()}"
10+
"${level.name}: [$loggerName] ${msg.toStringSafe()}${t.throwableToString()}"
1111

1212
override fun formatMessage(level: KotlinLoggingLevel, loggerName: String, marker: Marker?, msg: () -> Any?) =
13-
"${level.name}: [$loggerName] ${marker?.getName()} ${msg.toStringSafe()}"
13+
"${level.name}: [$loggerName] ${marker?.getName()} ${msg.toStringSafe()}"
1414

15-
override fun formatMessage(level: KotlinLoggingLevel, loggerName: String, marker: Marker?, t: Throwable?, msg: () -> Any?) =
16-
"${level.name}: [$loggerName] ${marker?.getName()} ${msg.toStringSafe()}${t.throwableToString()}"
15+
override fun formatMessage(
16+
level: KotlinLoggingLevel,
17+
loggerName: String,
18+
marker: Marker?,
19+
t: Throwable?,
20+
msg: () -> Any?
21+
) =
22+
"${level.name}: [$loggerName] ${marker?.getName()} ${msg.toStringSafe()}${t.throwableToString()}"
1723

1824
private fun Throwable?.throwableToString(): String {
1925
if (this == null) {

src/jsMain/kotlin/mu/Formatter.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ interface Formatter {
44
fun formatMessage(level: KotlinLoggingLevel, loggerName: String, msg: () -> Any?): Any?
55
fun formatMessage(level: KotlinLoggingLevel, loggerName: String, t: Throwable?, msg: () -> Any?): Any?
66
fun formatMessage(level: KotlinLoggingLevel, loggerName: String, marker: Marker?, msg: () -> Any?): Any?
7-
fun formatMessage(level: KotlinLoggingLevel, loggerName: String, marker: Marker?, t: Throwable?, msg: () -> Any?): Any?
7+
fun formatMessage(
8+
level: KotlinLoggingLevel,
9+
loggerName: String,
10+
marker: Marker?,
11+
t: Throwable?,
12+
msg: () -> Any?
13+
): Any?
814
}

0 commit comments

Comments
 (0)