logellipsis.cpp revision c34f9b1d1526bb5e7fa22d868de402fc50c318fe
1N/A/* $Id$ */
1N/A/** @file
1N/A * Runtime VBox - Logger, the ellipsis variants.
1N/A */
1N/A
1N/A/*
1N/A * Copyright (C) 2006-2007 Sun Microsystems, Inc.
1N/A *
1N/A * This file is part of VirtualBox Open Source Edition (OSE), as
1N/A * available from http://www.virtualbox.org. This file is free software;
1N/A * you can redistribute it and/or modify it under the terms of the GNU
1N/A * General Public License (GPL) as published by the Free Software
1N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
1N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1N/A *
1N/A * The contents of this file may alternatively be used under the terms
1N/A * of the Common Development and Distribution License Version 1.0
1N/A * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
1N/A * VirtualBox OSE distribution, in which case the provisions of the
1N/A * CDDL are applicable instead of those of the GPL.
1N/A *
1N/A * You may elect to license modified versions of this file under the
1N/A * terms and conditions of either the GPL or the CDDL or both.
1N/A *
1N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1N/A * Clara, CA 95054 USA or visit http://www.sun.com if you need
1N/A * additional information or have any questions.
1N/A */
1N/A
1N/A/*******************************************************************************
1N/A* Header Files *
1N/A*******************************************************************************/
1N/A#include <iprt/log.h>
1N/A#include <iprt/asm.h>
1N/A#include <iprt/stdarg.h>
1N/A
1N/A
1N/A/**
1N/A * Write to a logger instance.
1N/A *
1N/A * @param pLogger Pointer to logger instance.
1N/A * @param pvCallerRet Ignored.
1N/A * @param pszFormat Format string.
1N/A * @param ... Format arguments.
1N/A */
1N/ARTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...)
1N/A{
1N/A va_list args;
1N/A va_start(args, pszFormat);
1N/A#if defined(RT_OS_DARWIN) && defined(RT_ARCH_X86) && defined(IN_RING3)
1N/A /* manually align the stack before doing the call.
1N/A * We boldly assume that there is a stack frame here! */
1N/A __asm__ __volatile__("andl $-32, %%esp\t\n" ::: "%esp");
1N/A RTLogLoggerExV(pLogger, 0, ~0U, pszFormat, args);
1N/A#else
1N/A RTLogLoggerExV(pLogger, 0, ~0U, pszFormat, args);
1N/A#endif
1N/A va_end(args);
1N/A}
1N/A
1N/A
1N/A/**
1N/A * Write to a logger instance.
1N/A *
1N/A * This function will check whether the instance, group and flags makes up a
1N/A * logging kind which is currently enabled before writing anything to the log.
1N/A *
1N/A * @param pLogger Pointer to logger instance. If NULL the default logger instance will be attempted.
1N/A * @param fFlags The logging flags.
1N/A * @param iGroup The group.
1N/A * The value ~0U is reserved for compatability with RTLogLogger[V] and is
1N/A * only for internal usage!
1N/A * @param pszFormat Format string.
1N/A * @param ... Format arguments.
1N/A * @remark This is a worker function of LogIt.
1N/A */
1N/ARTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...)
1N/A{
1N/A va_list args;
1N/A va_start(args, pszFormat);
1N/A RTLogLoggerExV(pLogger, fFlags, iGroup, pszFormat, args);
1N/A va_end(args);
1N/A}
1N/A
1N/A
1N/A/**
1N/A * printf like function for writing to the default log.
1N/A *
1N/A * @param pszFormat Printf like format string.
1N/A * @param ... Optional arguments as specified in pszFormat.
1N/A *
1N/A * @remark The API doesn't support formatting of floating point numbers at the moment.
1N/A */
1N/ARTDECL(void) RTLogPrintf(const char *pszFormat, ...)
1N/A{
1N/A va_list args;
1N/A va_start(args, pszFormat);
1N/A RTLogPrintfV(pszFormat, args);
1N/A va_end(args);
1N/A}
1N/A
1N/A