aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/logger.js
blob: d0f7a7682cd29a7ce736a21578208f288a817cbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

import { getCurrentUser } from '@nextcloud/auth'
import { getLoggerBuilder } from '@nextcloud/logger'

const getLogger = user => {
	if (user === null) {
		return getLoggerBuilder()
			.setApp('core')
			.build()
	}
	return getLoggerBuilder()
		.setApp('core')
		.setUid(user.uid)
		.build()
}

export default getLogger(getCurrentUser())