logger.js 573 B

1234567891011121314151617181920212223242526
  1. /**
  2. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. import { getCurrentUser } from '@nextcloud/auth'
  6. import { getLoggerBuilder } from '@nextcloud/logger'
  7. const getLogger = user => {
  8. if (user === null) {
  9. return getLoggerBuilder()
  10. .setApp('core')
  11. .build()
  12. }
  13. return getLoggerBuilder()
  14. .setApp('core')
  15. .setUid(user.uid)
  16. .build()
  17. }
  18. export default getLogger(getCurrentUser())
  19. export const unifiedSearchLogger = getLoggerBuilder()
  20. .setApp('unified-search')
  21. .detectUser()
  22. .build()