mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
UI: Bladeburner console to use Settings.TimestampsFormat for logging (#1265)
This commit is contained in:
parent
52111f6e07
commit
1b8205e9d5
@ -33,7 +33,7 @@ import { Factions } from "../Faction/Factions";
|
||||
import { calculateHospitalizationCost } from "../Hospital/Hospital";
|
||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||
import { Settings } from "../Settings/Settings";
|
||||
import { getTimestamp } from "../utils/helpers/getTimestamp";
|
||||
import { formatTime } from "../utils/helpers/formatTime";
|
||||
import { joinFaction } from "../Faction/FactionHelpers";
|
||||
import { isSleeveInfiltrateWork } from "../PersonObjects/Sleeve/Work/SleeveInfiltrateWork";
|
||||
import { isSleeveSupportWork } from "../PersonObjects/Sleeve/Work/SleeveSupportWork";
|
||||
@ -185,7 +185,9 @@ export class Bladeburner {
|
||||
|
||||
log(input: string): void {
|
||||
// Adds a timestamp and then just calls postToConsole
|
||||
this.postToConsole(`[${getTimestamp()}] ${input}`);
|
||||
this.postToConsole(
|
||||
`[${formatTime(Settings.TimestampsFormat !== "" ? Settings.TimestampsFormat : "yyyy-MM-dd HH:mm:ss")}] ${input}`,
|
||||
);
|
||||
}
|
||||
|
||||
resetAction(): void {
|
||||
|
@ -1,11 +0,0 @@
|
||||
/** Returns a MM/DD HH:MM timestamp for the current time */
|
||||
export function getTimestamp(): string {
|
||||
const d: Date = new Date();
|
||||
// A negative slice value takes from the end of the string rather than the beginning.
|
||||
const stringWidth = -2;
|
||||
const formattedHours: string = `0${d.getHours()}`.slice(stringWidth);
|
||||
const formattedMinutes: string = `0${d.getMinutes()}`.slice(stringWidth);
|
||||
const formattedSeconds: string = `0${d.getSeconds()}`.slice(stringWidth);
|
||||
|
||||
return `${d.getMonth() + 1}/${d.getDate()} ${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
|
||||
}
|
Loading…
Reference in New Issue
Block a user