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
615de9ef
Commit
615de9ef
authored
Sep 29, 2019
by
liujiahua123123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miraiAPI
parent
91aed96c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
3 deletions
+21
-3
mirai-api/src/main/java/net/mamoe/mirai/MiraiAPI.java
mirai-api/src/main/java/net/mamoe/mirai/MiraiAPI.java
+5
-0
mirai-console/src/main/java/net/mamoe/mirai/MiraiConsole.java
...i-console/src/main/java/net/mamoe/mirai/MiraiConsole.java
+3
-0
mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java
mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java
+2
-0
mirai-core/src/main/java/net/mamoe/mirai/utils/MiraiLogger.kt
...i-core/src/main/java/net/mamoe/mirai/utils/MiraiLogger.kt
+11
-3
No files found.
mirai-api/src/main/java/net/mamoe/mirai/MiraiAPI.java
View file @
615de9ef
package
net.mamoe.mirai
;
package
net.mamoe.mirai
;
import
java.io.PrintStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,6 +33,10 @@ public class MiraiAPI {
...
@@ -32,6 +33,10 @@ public class MiraiAPI {
MiraiMain
.
main
(
args
);
MiraiMain
.
main
(
args
);
}
}
public
static
void
setLogger
(
PrintStream
stream
){
MiraiServer
.
getInstance
().
getLogger
().
setOutPutStream
(
stream
);
}
public
static
String
getMiraiVersion
(){
public
static
String
getMiraiVersion
(){
return
MiraiServer
.
MIRAI_VERSION
;
return
MiraiServer
.
MIRAI_VERSION
;
}
}
...
...
mirai-console/src/main/java/net/mamoe/mirai/MiraiConsole.java
View file @
615de9ef
...
@@ -15,4 +15,7 @@ public class MiraiConsole {
...
@@ -15,4 +15,7 @@ public class MiraiConsole {
}
}
public
void
log
(
Object
o
){
System
.
out
.
println
(
o
);
}
}
}
mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java
View file @
615de9ef
...
@@ -3,6 +3,8 @@ package net.mamoe.mirai;
...
@@ -3,6 +3,8 @@ package net.mamoe.mirai;
import
lombok.Getter
;
import
lombok.Getter
;
import
java.io.PrintStream
;
/**
/**
* @author NaturalHG
* @author NaturalHG
*/
*/
...
...
mirai-core/src/main/java/net/mamoe/mirai/utils/MiraiLogger.kt
View file @
615de9ef
...
@@ -3,6 +3,7 @@ package net.mamoe.mirai.utils
...
@@ -3,6 +3,7 @@ package net.mamoe.mirai.utils
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.network.packet.ServerPacket
import
net.mamoe.mirai.network.packet.ServerPacket
import
net.mamoe.mirai.network.packet.goto
import
net.mamoe.mirai.network.packet.goto
import
java.io.PrintStream
import
java.text.SimpleDateFormat
import
java.text.SimpleDateFormat
import
java.util.*
import
java.util.*
...
@@ -13,6 +14,12 @@ import java.util.*
...
@@ -13,6 +14,12 @@ import java.util.*
* @author NaturalHG
* @author NaturalHG
*/
*/
object
MiraiLogger
{
object
MiraiLogger
{
var
stream
:
PrintStream
=
System
.
out
fun
setOutPutStream
(
stream
:
PrintStream
)
{
this
.
stream
=
stream
}
fun
log
(
o
:
Any
?)
=
info
(
o
)
fun
log
(
o
:
Any
?)
=
info
(
o
)
fun
println
(
o
:
Any
?)
=
info
(
o
)
fun
println
(
o
:
Any
?)
=
info
(
o
)
fun
info
(
o
:
Any
?)
=
this
.
print
(
o
.
toString
(),
LoggerTextFormat
.
RESET
)
fun
info
(
o
:
Any
?)
=
this
.
print
(
o
.
toString
(),
LoggerTextFormat
.
RESET
)
...
@@ -28,16 +35,17 @@ object MiraiLogger {
...
@@ -28,16 +35,17 @@ object MiraiLogger {
fun
catching
(
e
:
Throwable
)
{
fun
catching
(
e
:
Throwable
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
/*
/*
*
this.print(e.message)
this.print(e.message)
this.print(e.localizedMessage)
this.print(e.localizedMessage)
this.print(e.cause.toString())*/
this.print(e.cause.toString())
*/
}
}
@Synchronized
@Synchronized
private
fun
print
(
value
:
String
?,
color
:
LoggerTextFormat
=
LoggerTextFormat
.
WHITE
)
{
private
fun
print
(
value
:
String
?,
color
:
LoggerTextFormat
=
LoggerTextFormat
.
WHITE
)
{
val
s
=
SimpleDateFormat
(
"MM-dd HH:mm:ss"
).
format
(
Date
())
val
s
=
SimpleDateFormat
(
"MM-dd HH:mm:ss"
).
format
(
Date
())
kotlin
.
io
.
println
(
"$color[Mirai] $s : $value"
)
stream
.
println
(
"$color[Mirai] $s : $value"
)
}
}
}
}
...
...
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