1 | ; $Id: VBoxGuestAdditionsLog.nsh 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; VBoxGuestAdditionLog.nsh - Logging functions.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2013-2020 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 |
|
---|
18 | ;
|
---|
19 | ; Macro for enable/disable logging
|
---|
20 | ; @param "true" to enable logging, "false" to disable.
|
---|
21 | ;
|
---|
22 | !macro _logEnable enable
|
---|
23 |
|
---|
24 | ${If} ${enable} == "true"
|
---|
25 | LogSet on
|
---|
26 | ${LogVerbose} "Started logging into separate file"
|
---|
27 | ${Else}
|
---|
28 | ${LogVerbose} "Stopped logging into separate file"
|
---|
29 | LogSet off
|
---|
30 | ${EndIf}
|
---|
31 |
|
---|
32 | !macroend
|
---|
33 | !define LogEnable "!insertmacro _logEnable"
|
---|
34 |
|
---|
35 | ;
|
---|
36 | ; Macro for (verbose) logging
|
---|
37 | ; @param Text to log.
|
---|
38 | ;
|
---|
39 | !macro _logVerbose text
|
---|
40 |
|
---|
41 | LogText "${text}"
|
---|
42 | IfSilent +2
|
---|
43 | DetailPrint "${text}"
|
---|
44 |
|
---|
45 | !macroend
|
---|
46 | !define LogVerbose "!insertmacro _logVerbose"
|
---|
47 |
|
---|
48 | ;
|
---|
49 | ; Sends a logging text to the running instance of VBoxTray
|
---|
50 | ; which then presents to text via balloon popup in the system tray (if enabled).
|
---|
51 | ;
|
---|
52 | ; @param Message type (0=Info, 1=Warning, 2=Error).
|
---|
53 | ; @param Message text.
|
---|
54 | ;
|
---|
55 | ; @todo Add message timeout as parameter.
|
---|
56 | ;
|
---|
57 | !macro _logToVBoxTray type text
|
---|
58 |
|
---|
59 | ${LogVerbose} "${text}"
|
---|
60 | !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1"
|
---|
61 | Push $0
|
---|
62 | ; Parameters:
|
---|
63 | ; - String: Description / Body
|
---|
64 | ; - String: Title / Name of application
|
---|
65 | ; - Integer: Type of message: 0 (Info), 1 (Warning), 2 (Error)
|
---|
66 | ; - Integer: Time (in msec) to show the notification
|
---|
67 | VBoxGuestInstallHelper::VBoxTrayShowBallonMsg "${text}" "VirtualBox Guest Additions Setup" ${type} 5000
|
---|
68 | Pop $0 ; Get return value (ignored for now)
|
---|
69 | Pop $0 ; Restore original $0 from stack
|
---|
70 | !endif
|
---|
71 |
|
---|
72 | !macroend
|
---|
73 | !define LogToVBoxTray "!insertmacro _logToVBoxTray"
|
---|