Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
9631a2de
Commit
9631a2de
authored
May 24, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loggers
parent
5485ffe8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileLogger.kt
...re/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileLogger.kt
+3
-3
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.jvm.kt
...vmMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.jvm.kt
+3
-0
No files found.
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileLogger.kt
View file @
9631a2de
...
...
@@ -13,8 +13,8 @@ import java.io.File
import
java.text.SimpleDateFormat
import
java.util.*
private
val
currentDay
=
Calendar
.
getInstance
()[
Calendar
.
DAY_OF_MONTH
]
private
val
currentDate
=
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
Date
())
private
val
currentDay
get
()
=
Calendar
.
getInstance
()[
Calendar
.
DAY_OF_MONTH
]
private
val
currentDate
get
()
=
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
Date
())
/**
* 将日志写入('append')到特定文件.
...
...
@@ -22,7 +22,7 @@ private val currentDate = SimpleDateFormat("yyyy-MM-dd").format(Date())
* @see PlatformLogger 查看格式信息
*/
class
SingleFileLogger
@JvmOverloads
constructor
(
identity
:
String
,
file
:
File
=
File
(
"$identity-$currentDate.log"
))
:
PlatformLogger
(
identity
,
{
file
.
appendText
(
it
)
},
false
)
{
PlatformLogger
(
identity
,
{
file
.
appendText
(
it
+
"\n"
)
},
false
)
{
init
{
file
.
createNewFile
()
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.jvm.kt
View file @
9631a2de
...
...
@@ -45,6 +45,9 @@ import java.util.*
*/
actual
open
class
PlatformLogger
@JvmOverloads
constructor
(
override
val
identity
:
String
?
=
"Mirai"
,
/**
* 日志输出. 不会自动添加换行
*/
open
val
output
:
(
String
)
->
Unit
,
val
isColored
:
Boolean
=
true
)
:
MiraiLoggerPlatformBase
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment