Skip to content

Commit

Permalink
fix: #48 move logger utils to root
Browse files Browse the repository at this point in the history
  • Loading branch information
vuhuucuong committed Feb 12, 2020
1 parent cd623b3 commit 115163e
Show file tree
Hide file tree
Showing 42 changed files with 39 additions and 208 deletions.
2 changes: 1 addition & 1 deletion packages/aml-checklist/src/sagas/checklist-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { handlePepSearchStatus } from '@/utils/pep-search'
import dayjs from 'dayjs'
import { ID_STATUS } from '@/components/ui/modal/modal'
import { changeTimeZoneLocalForIdentityCheck, changeTimeZoneUTCForIdentityCheck } from '@/utils/datetime'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const fetchChecklist = async ({ id, headers }) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/aml-checklist/src/sagas/identity-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { initAuthorizedRequestHeaders } from '@/utils/api'
import { errorThrownServer } from '../actions/error'
import { identityTypesReceiveData, identityTypesRequestFailure } from '../actions/identity-types'
import errorMessages from '../constants/error-messages'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const identityTypesDataFetch = function*() {
const headers = yield call(initAuthorizedRequestHeaders)
Expand Down
32 changes: 0 additions & 32 deletions packages/aml-checklist/src/utils/__tests__/error-logger.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/aml-checklist/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"@/*": ["src/*"],
"@reapit/cognito-auth": ["../cognito-auth/src"],
"@reapit/elements": ["../elements/src"],
"@reapit/foundations-ts-definitions": ["./src/types/api-2020-01-31"]
"@reapit/foundations-ts-definitions": ["./src/types/api-2020-01-31"],
"logger": ["../../scripts/logger/sentry-logger.ts"]
}
},
"include": ["src"]
Expand Down
5 changes: 1 addition & 4 deletions packages/geo-diary/src/sagas/appointment-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { AppointmentDetailRequestParams } from '@/actions/appointment-detail'
import { selectAppointmentDetail } from '@/selectors/appointment-detail'
import { selectAppointmentsFilterTime, selectAppointmentWithId } from '@/selectors/appointments'
import { fetchAppointment, updateAppointment } from './api'
import { logger } from 'logger'

export const appointmentDetailDataFetch = function*({ data: { id } }: Action<AppointmentDetailRequestParams>) {
yield put(appointmentDetailShowModal())
Expand Down Expand Up @@ -78,11 +79,7 @@ export const cancelAppointmentRequest = function*() {
yield put(appointmentsRequestData({ time: filterTime }))
}
} catch (error) {
<<<<<<< HEAD
console.error(error.message)
=======
logger(error)
>>>>>>> fix: #48 sentry log not capture error, add logger util in all apps
yield put(
errorThrownServer({
type: 'SERVER',
Expand Down
2 changes: 1 addition & 1 deletion packages/geo-diary/src/sagas/appointments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { initAuthorizedRequestHeaders } from '@/utils/api'
import { sortAppoinmentsByStartTime } from '@/utils/sort-appointments-by-start-time'
import utc from 'dayjs/plugin/utc'
import { fetchAppointmentMetadata } from './api'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

dayjs.extend(utc)

Expand Down
2 changes: 1 addition & 1 deletion packages/geo-diary/src/sagas/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ActionTypes from '../constants/action-types'
import { errorThrownServer } from '../actions/error'
import errorMessages from '../constants/error-messages'
import { Action } from '@/types/core'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const homeDataFetch = function*() {
yield put(homeLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/geo-diary/src/sagas/next-appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { nextAppointmentValidateSuccess, nextAppointmentClear } from '@/actions/
import { selectUserCode } from '@/selectors/auth'
import { Action } from '@/types/core'
import { getLoggedInUser } from '../components/common/appointment-detail/appointment-detail'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

type Position = {
lat: number
Expand Down
32 changes: 0 additions & 32 deletions packages/geo-diary/src/utils/__tests__/error-logger.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/geo-diary/src/utils/error-logger.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/geo-diary/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"paths": {
"@/*": ["src/*"],
"@reapit/cognito-auth": ["../cognito-auth/src"],
"@reapit/elements": ["../elements/src"]
"@reapit/elements": ["../elements/src"],
"logger": ["../../scripts/logger/sentry-logger.ts"]
}
},
"include": ["src"]
Expand Down
2 changes: 1 addition & 1 deletion packages/lifetime-legal/src/sagas/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fetcher, setQueryParams } from '@reapit/elements'
import { URLS } from '@/constants/api'
import { changeTimeZoneUTCForIdentityCheck, changeTimeZoneLocalForIdentityCheck } from '@/utils/datetime'
import { CONTACTS_PER_PAGE } from '@/constants/paginator'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const fetchContact = async ({ contactId, headers }) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/lifetime-legal/src/sagas/checklist-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
createIdentityCheck,
uploadImage,
} from './api'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const checklistDetailDataFetch = function*({ data: id }) {
yield put(checklistDetailLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/lifetime-legal/src/sagas/identity-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { errorThrownServer } from '../actions/error'
import { identityTypesReceiveData, identityTypesRequestFailure } from '../actions/identity-types'
import errorMessages from '../constants/error-messages'
import { fetchIdentityDocumentTypes } from './api'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const identityTypesDataFetch = function*() {
const headers = yield call(initAuthorizedRequestHeaders)
Expand Down
2 changes: 1 addition & 1 deletion packages/lifetime-legal/src/sagas/submit-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { errorThrownServer } from '../actions/error'
import errorMessages from '../constants/error-messages'
import routes from '@/constants/routes'
import { history } from '@/core/router'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const submitCheck = function*({ data: id }: Action<string>) {
yield put(submitChecksSetFormState('SUBMITTING'))
Expand Down
2 changes: 1 addition & 1 deletion packages/lifetime-legal/src/sagas/success.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Action } from '../types/core'
import { errorThrownServer } from '../actions/error'
import errorMessages from '../constants/error-messages'
import { DynamicLinkParams, navigateDynamicApp } from '@reapit/elements'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const submitComplete = function*({
data: { dynamicLinkParams },
Expand Down
32 changes: 0 additions & 32 deletions packages/lifetime-legal/src/utils/__tests__/error-logger.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/lifetime-legal/src/utils/error-logger.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/lifetime-legal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"paths": {
"@/*": ["src/*"],
"@reapit/cognito-auth": ["../cognito-auth/src"],
"@reapit/elements": ["../elements/src"]
"@reapit/elements": ["../elements/src"],
"logger": ["../../scripts/logger/sentry-logger.ts"]
}
},
"include": ["src"]
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/admin-approvals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { URLS, MARKETPLACE_HEADERS } from '@/constants/api'
import { REVISIONS_PER_PAGE } from '@/constants/paginator'
import { fetcher } from '@reapit/elements'
import { Action } from '@/types/core'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const adminApprovalsDataFetch = function*({ data: page }) {
yield put(adminApprovalsLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/admin-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { selectAdminAppsData } from '@/selector/admin'
import { AppDetailModel } from '@reapit/foundations-ts-definitions'
import api from './api'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const adminAppsFetch = function*() {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/admin-dev-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ActionTypes from '@/constants/action-types'
import errorMessages from '@/constants/error-messages'
import { URLS, MARKETPLACE_HEADERS } from '@/constants/api'
import { REVISIONS_PER_PAGE } from '@/constants/paginator'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const adminDevManagementRequestDataHandler = function*({ data: { page, queryString } }) {
yield put(adminDevManagementLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/admin-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { fetcher, setQueryParams } from '@reapit/elements'
import { Action } from '@/types/core'
import { Area } from '@/components/pages/admin-stats'
import { getDateRange } from '@/utils/admin-stats'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const adminStatsDataFetch = function*({ data }) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fetcher, setQueryParams } from '@reapit/elements'
import { URLS, MARKETPLACE_HEADERS } from '../constants/api'
import { APPS_PER_PAGE } from '@/constants/paginator'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const fetchAdminApps = async ({ params }) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/app-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { errorThrownServer } from '../actions/error'
import errorMessages from '../constants/error-messages'
import api from './api'
import { adminAppsReceiveData } from '@/actions/admin-apps'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const appDeleteRequestSaga = function*({ data: appId }: Action<string>) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/app-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ActionTypes from '../constants/action-types'
import { errorThrownServer } from '../actions/error'
import errorMessages from '../constants/error-messages'
import { Action } from '@/types/core'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const fetchAppDetail = async ({ clientId, id }) => {
const response = await fetcher({
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/app-installations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@/actions/app-installations'
import { selectLoggedUserEmail, selectClientId } from '@/selector/client'
import { selectDeveloperId } from '@/selector/developer'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const fetchInstallations = async (data: InstallationParams) => {
const response = await fetcher({
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Action } from '@/types/core'
import { selectClientId, selectFeaturedApps } from '@/selector/client'
import { selectCategories } from '@/selector/app-categories'
import { ClientItem, ClientParams } from '@/reducers/client'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const clientDataFetch = function*({ data }) {
yield put(clientLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/developer-set-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import errorMessages from '@/constants/error-messages'
import { fetcher } from '@reapit/elements'
import { URLS, MARKETPLACE_HEADERS } from '@/constants/api'
import { DeveloperModel } from '@reapit/foundations-ts-definitions'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const developerSetStatusRequestSaga = function*({ data: dev }) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/developer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Action } from '../types/core'
import { APPS_PER_PAGE } from '@/constants/paginator'
import { selectDeveloperId } from '@/selector/developer'
import { DeveloperItem, DeveloperRequestParams } from '@/reducers/developer'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const developerDataFetch = function*({ data }) {
yield put(developerLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/forgot-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Routes from '@/constants/routes'
import { Action } from '@/types/core'
import { forgotPasswordLoading } from '@/actions/forgot-password'
import { resetPassword } from '@reapit/cognito-auth'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const requestForgotPassword = function*({ data: email }) {
yield put(forgotPasswordLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/installed-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { fetcher } from '@reapit/elements'
import { Action } from '@/types/core'
import { INSTALLED_APPS_PERPAGE } from '@/constants/paginator'
import { selectClientId } from '@/selector/client'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const installedAppsDataFetch = function*({ data: page }) {
yield put(installedAppsLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/my-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { fetcher } from '@reapit/elements'
import { Action } from '@/types/core'
import { APPS_PER_PAGE } from '@/constants/paginator'
import { selectClientId } from '@/selector/client'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const myAppsDataFetch = function*({ data: page }) {
yield put(myAppsLoading(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/marketplace/src/sagas/reset-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { errorThrownServer } from '@/actions/error'
import Routes from '@/constants/routes'
import { history } from '@/core/router'
import { confirmPassword } from '@reapit/cognito-auth'
import { logger } from '@/utils/error-logger'
import { logger } from 'logger'

export const developerResetPassword = function*({ data }: Action<ResetPasswordParams>) {
yield put(resetPasswordLoading(true))
Expand Down
Loading

0 comments on commit 115163e

Please sign in to comment.