Skip to content

Commit

Permalink
Fix Logger Timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed Jul 14, 2023
1 parent 92cce9f commit 9ee51e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.7

- Fix logger timestamps

# 1.0.6

- Fix small bug where `sync` did not set `collection` for proper updating.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stuyk/cross-resource-cache",
"version": "1.0.6",
"version": "1.0.7",
"description": "add mongodb database saving to cross resource environments for altv",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
20 changes: 9 additions & 11 deletions src/utility/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import * as fs from 'fs';

let enabled = true;

function getTimeAsString() {
const time = new Date(Date.now());
const timeframe = [time.getHours(), time.getMinutes(), time.getSeconds()];

let data = [];

for (let value of timeframe) {
data.push(value <= 9 ? `0${value}` : `${value}`);
data.push(':');
function toPadded(value: number) {
if (value <= 9) {
return `0${value}`;
}

data.pop();
return data.join();
return `${value}`;
}

function getTimeAsString() {
const time = new Date(Date.now());
return `${toPadded(time.getHours())}:${toPadded(time.getMinutes())}:${toPadded(time.getSeconds())}`;
}

export function write(message: string) {
Expand Down

0 comments on commit 9ee51e8

Please sign in to comment.