Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: YLS 구조 변경 및 타임스탬프 생성 #4

Merged
merged 11 commits into from
Jan 26, 2024
Prev Previous commit
Next Next commit
feat: add Timestamp, Logger
Hanna922 committed Jan 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 3713129c3374e67b6cbfe74d63044b1d8b177bc3
17 changes: 16 additions & 1 deletion src/Logger.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@ const createRandomId = () => {
};

const createTimestamp = () => {
// Todo: create timestamp
const offset = new Date().getTimezoneOffset() * 60 * 1000;
const now = new Date(Date.now() - offset);
return now.toISOString();
};

export const useYLSLogger = () => {
@@ -28,3 +30,16 @@ export const useYLSLogger = () => {
click,
};
};

export const Logger = ({ path, platform, serviceName, name, message }: LoggerType) => {
return {
userId: createRandomId(),
timestamp: createTimestamp(),
event: {
platform,
serviceName,
name,
message,
},
};
};