Skip to content

Commit

Permalink
Change app log calls to info severity
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Jun 26, 2024
1 parent fcd9de7 commit cc1cca1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DeviceRepository(
managementService.getDeviceList(accountNumber)

suspend fun updateDevice() {
Logger.d("Update device")
Logger.i("Update device")
managementService.updateDevice()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {

override fun onCreate() {
super.onCreate()
Logger.d("MullvadVpnService: onCreate")
Logger.i("MullvadVpnService: onCreate")

loadKoinModules(listOf(vpnServiceModule, apiEndpointModule))
with(getKoin()) {
Expand Down Expand Up @@ -101,7 +101,7 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Logger.d(
Logger.i(
"onStartCommand (intent=$intent, action=${intent?.action}, flags=$flags, startId=$startId)"
)

Expand All @@ -111,7 +111,7 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {
// where the service would potentially otherwise be too slow running `startForeground`.
when {
keyguardManager.isKeyguardLocked -> {
Logger.d("Keyguard is locked, ignoring command")
Logger.i("Keyguard is locked, ignoring command")
}
intent.isFromSystem() || intent?.action == KEY_CONNECT_ACTION -> {
// Only show on foreground if we have permission
Expand All @@ -130,10 +130,10 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {

override fun onBind(intent: Intent?): IBinder {
bindCount.incrementAndGet()
Logger.d("onBind: $intent")
Logger.i("onBind: $intent")

if (intent.isFromSystem()) {
Logger.d("onBind from system")
Logger.i("onBind from system")
_shouldBeOnForeground.update { true }
}

Expand Down Expand Up @@ -177,14 +177,14 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {

// Foreground?
if (intent.isFromSystem()) {
Logger.d("onUnbind from system")
Logger.i("onUnbind from system")
_shouldBeOnForeground.update { false }
}

if (count == 0) {
Logger.d("No one bound to the service, stopSelf()")
Logger.i("No one bound to the service, stopSelf()")
lifecycleScope.launch {
Logger.d("Waiting for disconnected state")
Logger.i("Waiting for disconnected state")
// TODO This needs reworking, we should not wait for the disconnected state, what we
// want is the notification of disconnected to go out before we start shutting down
connectionProxy.tunnelState
Expand All @@ -195,7 +195,7 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {
.first()

if (bindCount.get() == 0) {
Logger.d("Stopping service")
Logger.i("Stopping service")
stopSelf()
}
}
Expand All @@ -204,7 +204,7 @@ class MullvadVpnService : TalpidVpnService(), ShouldBeOnForegroundProvider {
}

override fun onDestroy() {
Logger.d("MullvadVpnService: onDestroy")
Logger.i("MullvadVpnService: onDestroy")
managementService.stop()

// Shutting down the daemon gracefully
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class ForegroundNotificationManager(
scope.launch {
foregroundProvider.shouldBeOnForeground.collect {
if (it) {
Logger.d("Starting foreground")
Logger.i("Starting foreground")
notifyForeground(getTunnelStateNotificationOrDefault())
} else {
Logger.d("Stopping foreground")
Logger.i("Stopping foreground")
vpnService.stopForeground(Service.STOP_FOREGROUND_DETACH)
}
}
Expand All @@ -50,12 +50,12 @@ class ForegroundNotificationManager(
if (VpnService.prepare(vpnService) != null) {
// Got connect/disconnect intent, but we don't have permission to go in foreground.
// tunnel state will return permission and we will eventually get stopped by system.
Logger.d("Did not start foreground: VPN permission not granted")
Logger.i("Did not start foreground: VPN permission not granted")
return
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
Logger.d("Starting foreground UPSIDE_DOWN_CAKE")
Logger.i("Starting foreground UPSIDE_DOWN_CAKE")
vpnService.startForeground(
tunnelStateNotificationProvider.notificationId.value,
androidNotification,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class MullvadTileService : TileService() {
val isSetup = VpnService.prepare(applicationContext) == null
// TODO This logic should be more advanced, we should ensure user has an account setup etc.
if (!isSetup) {
Logger.d("TileService: VPN service not setup, starting main activity")
Logger.i("TileService: VPN service not setup, starting main activity")

val intent =
Intent().apply {
Expand All @@ -105,7 +105,7 @@ class MullvadTileService : TileService() {
startActivityAndCollapseCompat(intent)
return
} else {
Logger.d("TileService: VPN service is setup")
Logger.i("TileService: VPN service is setup")
}
val intent =
Intent().apply {
Expand Down

0 comments on commit cc1cca1

Please sign in to comment.