VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/log/logrel.cpp

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.7 KB
Line 
1/* $Id: logrel.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Runtime VBox - Release Logger.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37
38/*********************************************************************************************************************************
39* Header Files *
40*********************************************************************************************************************************/
41#include <iprt/log.h>
42#include "internal/iprt.h"
43
44
45/**
46 * Write to a logger instance, defaulting to the release one.
47 *
48 * This function will check whether the instance, group and flags makes up a
49 * logging kind which is currently enabled before writing anything to the log.
50 *
51 * @param pLogger Pointer to logger instance. If NULL the default release instance is attempted.
52 * @param fFlags The logging flags.
53 * @param iGroup The group.
54 * The value ~0U is reserved for compatibility with RTLogLogger[V] and is
55 * only for internal usage!
56 * @param pszFormat Format string.
57 * @param args Format arguments.
58 */
59RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args)
60{
61 /*
62 * A NULL logger means default instance.
63 */
64 if (!pLogger)
65 {
66 pLogger = RTLogRelGetDefaultInstance();
67 if (!pLogger)
68 return;
69 }
70 RTLogLoggerExV(pLogger, fFlags, iGroup, pszFormat, args);
71}
72RT_EXPORT_SYMBOL(RTLogRelLoggerV);
73
74
75/**
76 * vprintf like function for writing to the default release log.
77 *
78 * @param pszFormat Printf like format string.
79 * @param args Optional arguments as specified in pszFormat.
80 *
81 * @remark The API doesn't support formatting of floating point numbers at the moment.
82 */
83RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args)
84{
85 RTLogRelLoggerV(NULL, 0, ~0U, pszFormat, args);
86}
87RT_EXPORT_SYMBOL(RTLogRelPrintfV);
88
89
90/**
91 * Changes the buffering setting of the default release logger.
92 *
93 * This can be used for optimizing longish logging sequences.
94 *
95 * @returns The old state.
96 * @param fBuffered The new state.
97 */
98RTDECL(bool) RTLogRelSetBuffering(bool fBuffered)
99{
100 PRTLOGGER pLogger = RTLogRelGetDefaultInstance();
101 if (pLogger)
102 return RTLogSetBuffering(pLogger, fBuffered);
103 return false;
104}
105RT_EXPORT_SYMBOL(RTLogRelSetBuffering);
106
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use