-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
225 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ node_modules/ | |
*.old | ||
*.swp | ||
*.tmp | ||
gshtml5.version | ||
|
||
## System files | ||
.directory | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {GoldenSun} from "GoldenSun"; | ||
|
||
export enum msg_types { | ||
INFO = "info", | ||
WARNING = "warning", | ||
ERROR = "error", | ||
} | ||
|
||
/** | ||
* This class is responsible to log messages mainly in case of | ||
* user bad input. If you're running desktop app, it will create | ||
* a log file inside logs directory. | ||
*/ | ||
export class Logger { | ||
private data: GoldenSun; | ||
|
||
constructor(data: GoldenSun) { | ||
this.data = data; | ||
this.log_message("Engine started.", msg_types.INFO); | ||
} | ||
|
||
log_message(message: string, type: msg_types = msg_types.WARNING) { | ||
if (!message) { | ||
return; | ||
} | ||
const now = new Date().toLocaleString(); | ||
switch (type) { | ||
case msg_types.INFO: | ||
message = `GSHTML5 - [${now}] [INFO]: ${message}`; | ||
console.log(message); | ||
break; | ||
case msg_types.WARNING: | ||
message = `GSHTML5 - [${now}] [WARNING]: ${message}`; | ||
console.warn(message); | ||
break; | ||
case msg_types.ERROR: | ||
message = `GSHTML5 - [${now}] [ERROR]: ${message}`; | ||
console.error(message); | ||
break; | ||
default: | ||
return; | ||
} | ||
if (this.data.electron_app) { | ||
this.data.ipcRenderer.send("register-log", message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.