VirtualBox

source: vbox/trunk/include/VBox/com/utils.h@ 94803

Last change on this file since 94803 was 94803, checked in by vboxsync, 3 years ago

com/utils: Add an extended version of VBoxLogRelCreate() which takes an optional log output interface table pointer, bugref:9955

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/** @file
2 * MS COM / XPCOM Abstraction Layer - COM initialization / shutdown.
3 */
4
5/*
6 * Copyright (C) 2005-2022 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_com_utils_h
27#define VBOX_INCLUDED_com_utils_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include "iprt/types.h"
33
34/** @addtogroup grp_com
35 * @{
36 */
37
38namespace com
39{
40
41/**
42 * Returns the VirtualBox user home directory.
43 *
44 * On failure, this function will return a path that caused a failure (or
45 * NULL if the failure is not path-related).
46 *
47 * On success, this function will try to create the returned directory if it
48 * doesn't exist yet. This may also fail with the corresponding status code.
49 *
50 * If @a aDirLen is smaller than RTPATH_MAX then there is a great chance that
51 * this method will return VERR_BUFFER_OVERFLOW.
52 *
53 * @param aDir Buffer to store the directory string in UTF-8 encoding.
54 * @param aDirLen Length of the supplied buffer including space for the
55 * terminating null character, in bytes.
56 * @param fCreateDir Flag whether to create the returned directory on success
57 * if it doesn't exist.
58 * @returns VBox status code.
59 */
60int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen, bool fCreateDir = true);
61
62/**
63 * Creates a release log file, used both in VBoxSVC and in API clients.
64 *
65 * @param pszEntity Human readable name of the program.
66 * @param pszLogFile Name of the release log file.
67 * @param fFlags Logger instance flags.
68 * @param pszGroupSettings Group logging settings.
69 * @param pszEnvVarBase Base environment variable name for the logger.
70 * @param fDestFlags Logger destination flags.
71 * @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
72 * @param cHistory Number of old log files to keep.
73 * @param uHistoryFileTime Maximum amount of time to put in a log file.
74 * @param uHistoryFileSize Maximum size of a log file before rotating.
75 * @param pErrInfo Where to return extended error information.
76 * Optional.
77 *
78 * @returns VBox status code.
79 */
80int VBoxLogRelCreate(const char *pszEntity, const char *pszLogFile,
81 uint32_t fFlags, const char *pszGroupSettings,
82 const char *pszEnvVarBase, uint32_t fDestFlags,
83 uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
84 uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
85 PRTERRINFO pErrInfo);
86
87/**
88 * Creates a release log file, used both in VBoxSVC and in API clients.
89 *
90 * @param pszEntity Human readable name of the program.
91 * @param pszLogFile Name of the release log file.
92 * @param fFlags Logger instance flags.
93 * @param pszGroupSettings Group logging settings.
94 * @param pszEnvVarBase Base environment variable name for the logger.
95 * @param fDestFlags Logger destination flags.
96 * @param cMaxEntriesPerGroup Limit for log entries per group. UINT32_MAX for no limit.
97 * @param cHistory Number of old log files to keep.
98 * @param uHistoryFileTime Maximum amount of time to put in a log file.
99 * @param uHistoryFileSize Maximum size of a log file before rotating.
100 * @param pOutputIf The optional file output interface, can be NULL which will
101 * make use of the default one.
102 * @param pvOutputIfUser The opaque user data to pass to the callbacks in the output interface.
103 * @param pErrInfo Where to return extended error information.
104 * Optional.
105 *
106 * @returns VBox status code.
107 *
108 * @note Can't include log.h here because of precompiled header fun, hence pOutputIf is void *...
109 */
110int VBoxLogRelCreateEx(const char *pszEntity, const char *pszLogFile,
111 uint32_t fFlags, const char *pszGroupSettings,
112 const char *pszEnvVarBase, uint32_t fDestFlags,
113 uint32_t cMaxEntriesPerGroup, uint32_t cHistory,
114 uint32_t uHistoryFileTime, uint64_t uHistoryFileSize,
115 const void *pOutputIf, void *pvOutputIfUser,
116 PRTERRINFO pErrInfo);
117
118} /* namespace com */
119
120/** @} */
121#endif /* !VBOX_INCLUDED_com_utils_h */
122
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette