1af69d88dSmrg/*
2af69d88dSmrg * Copyright (c) 2012 Apple Inc.
3af69d88dSmrg *
4af69d88dSmrg * Permission is hereby granted, free of charge, to any person
5af69d88dSmrg * obtaining a copy of this software and associated documentation files
6af69d88dSmrg * (the "Software"), to deal in the Software without restriction,
7af69d88dSmrg * including without limitation the rights to use, copy, modify, merge,
8af69d88dSmrg * publish, distribute, sublicense, and/or sell copies of the Software,
9af69d88dSmrg * and to permit persons to whom the Software is furnished to do so,
10af69d88dSmrg * subject to the following conditions:
11af69d88dSmrg *
12af69d88dSmrg * The above copyright notice and this permission notice shall be
13af69d88dSmrg * included in all copies or substantial portions of the Software.
14af69d88dSmrg *
15af69d88dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16af69d88dSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17af69d88dSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18af69d88dSmrg * NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
19af69d88dSmrg * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20af69d88dSmrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21af69d88dSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22af69d88dSmrg * DEALINGS IN THE SOFTWARE.
23af69d88dSmrg *
24af69d88dSmrg * Except as contained in this notice, the name(s) of the above
25af69d88dSmrg * copyright holders shall not be used in advertising or otherwise to
26af69d88dSmrg * promote the sale, use or other dealings in this Software without
27af69d88dSmrg * prior written authorization.
28af69d88dSmrg */
29af69d88dSmrg
30af69d88dSmrg#ifndef APPLE_GLX_LOG_H
31af69d88dSmrg#define APPLE_GLX_LOG_H
32af69d88dSmrg
33af69d88dSmrg#include <sys/cdefs.h>
34af69d88dSmrg#include <asl.h>
35af69d88dSmrg
36af69d88dSmrgvoid apple_glx_log_init(void);
37af69d88dSmrg
38af69d88dSmrg__printflike(5, 6)
39af69d88dSmrgvoid _apple_glx_log(int level, const char *file, const char *function,
40af69d88dSmrg                    int line, const char *fmt, ...);
41af69d88dSmrg#define apple_glx_log(l, f, args ...) \
4201e04c3fSmrg    _apple_glx_log(l, __FILE__, __func__, __LINE__, f, ## args)
43af69d88dSmrg
44af69d88dSmrg
45af69d88dSmrg__printflike(5, 0)
46af69d88dSmrgvoid _apple_glx_vlog(int level, const char *file, const char *function,
47af69d88dSmrg                     int line, const char *fmt, va_list v);
48af69d88dSmrg#define apple_glx_vlog(l, f, v) \
4901e04c3fSmrg    _apple_glx_vlog(l, __FILE__, __func__, __LINE__, f, v)
50af69d88dSmrg
51af69d88dSmrg/* This is just here to help the transition.
52af69d88dSmrg * TODO: Replace calls to apple_glx_diagnostic
53af69d88dSmrg */
54af69d88dSmrg#define apple_glx_diagnostic(f, args ...) \
55af69d88dSmrg    apple_glx_log(ASL_LEVEL_DEBUG, f, ## args)
56af69d88dSmrg
57af69d88dSmrg#endif
58