Skip to content
Snippets Groups Projects
Commit 50e68e40 authored by Gregor Schulz's avatar Gregor Schulz
Browse files

improve logging

parent 804aa828
No related branches found
No related tags found
No related merge requests found
...@@ -15,8 +15,6 @@ export type HoliEventResponse = { ...@@ -15,8 +15,6 @@ export type HoliEventResponse = {
} }
export const toHoliEvent = (activity: Activity): HoliEvent | null => { export const toHoliEvent = (activity: Activity): HoliEvent | null => {
if (activity.period.permanent) return null
return { return {
id: activity.id.toString(), id: activity.id.toString(),
title: activity.name, title: activity.name,
...@@ -44,10 +42,10 @@ export const fetchEvent = async (input: FetchEventInput) => { ...@@ -44,10 +42,10 @@ export const fetchEvent = async (input: FetchEventInput) => {
const url = new URL(`${APP_API_BASE_URL}/activities/${input.id}`) const url = new URL(`${APP_API_BASE_URL}/activities/${input.id}`)
const startDate = Date.now() const startDate = Date.now()
logger.info(`fetching event from ${url}`) logger.debug(`fetching event from ${url}`)
const response = await fetch(url) const response = await fetch(url)
if (response.status === 404) { if (!response.ok) {
throw new NotFound('Not found') throw new NotFound('Not found')
} }
...@@ -70,6 +68,6 @@ export const fetchEvent = async (input: FetchEventInput) => { ...@@ -70,6 +68,6 @@ export const fetchEvent = async (input: FetchEventInput) => {
throw e throw e
} finally { } finally {
const duration = Date.now() - startDate const duration = Date.now() - startDate
logger.debug(`fetching event took ${duration} ms`) logger.info(`fetching event took ${duration} ms`)
} }
} }
...@@ -107,7 +107,7 @@ const fetchEventsPage = async ( ...@@ -107,7 +107,7 @@ const fetchEventsPage = async (
const startDate = Date.now() const startDate = Date.now()
logger.info(`fetching projects from ${url}`) logger.debug(`fetching events from ${url}`)
try { try {
const response = await fetch(url, { const response = await fetch(url, {
// gregor: we don't need to send the api key to the App api // gregor: we don't need to send the api key to the App api
...@@ -133,7 +133,7 @@ const fetchEventsPage = async ( ...@@ -133,7 +133,7 @@ const fetchEventsPage = async (
throw e throw e
} finally { } finally {
const duration = Date.now() - startDate const duration = Date.now() - startDate
logger.debug(`fetching projects took ${duration} ms`) logger.info(`fetching projects took ${duration} ms`)
} }
} }
......
...@@ -56,6 +56,7 @@ export type EventRequest = { ...@@ -56,6 +56,7 @@ export type EventRequest = {
} }
const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput => { const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput => {
logger.debug('validating request: ' + JSON.stringify(request))
return { return {
limit: request.limit ?? 5, limit: request.limit ?? 5,
offset: request.offset ?? 0, offset: request.offset ?? 0,
...@@ -64,7 +65,7 @@ const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput => ...@@ -64,7 +65,7 @@ const validateEventsRequestInput = (request: EventsRequest): FetchEventsInput =>
} }
const validateEventRequestInput = (request: EventRequest): FetchEventInput => { const validateEventRequestInput = (request: EventRequest): FetchEventInput => {
console.log(request) logger.debug('validating request: ' + JSON.stringify(request))
return { return {
id: request.id, id: request.id,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment