File tree Expand file tree Collapse file tree 2 files changed +22
-53
lines changed
flutter-idea/src/io/flutter/logging Expand file tree Collapse file tree 2 files changed +22
-53
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 5
5
*/
6
6
package io .flutter .logging ;
7
7
8
+ import com .intellij .openapi .application .PathManager ;
8
9
import com .intellij .openapi .diagnostic .Logger ;
9
10
import org .jetbrains .annotations .NotNull ;
10
11
12
+ import java .io .File ;
13
+ import java .io .IOException ;
14
+ import java .util .logging .FileHandler ;
15
+ import java .util .logging .SimpleFormatter ;
16
+
11
17
public class PluginLogger {
18
+ private static final String LOG_FILE_NAME = "flutter.log" ;
19
+ private static final FileHandler fileHandler ;
20
+ static {
21
+ final String logPath = PathManager .getLogPath ();
22
+ try {
23
+ fileHandler = new FileHandler (logPath + File .separatorChar + LOG_FILE_NAME , 1024 * 1024 , 1 );
24
+ }
25
+ catch (IOException e ) {
26
+ throw new RuntimeException (e );
27
+ }
28
+ System .setProperty ("java.util.logging.SimpleFormatter.format" ,
29
+ "%1$tF %1$tT %3$s [%4$-7s] %5$s %6$s %n" );
30
+ fileHandler .setFormatter (new SimpleFormatter ());
31
+ }
32
+
12
33
public static Logger createLogger (@ NotNull Class logClass ) {
13
- java .util .logging .Logger .getLogger (logClass .getName ()).addHandler (new PluginLogHandler () );
34
+ java .util .logging .Logger .getLogger (logClass .getName ()).addHandler (fileHandler );
14
35
return Logger .getInstance (logClass .getName ());
15
36
}
16
37
}
You can’t perform that action at this time.
0 commit comments