[134] | 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- |
---|
| 2 | * |
---|
| 3 | * Copyright (C) 2005 William Jon McCann <mccann@jhu.edu> |
---|
| 4 | * |
---|
| 5 | * This program is free software; you can redistribute it and/or modify |
---|
| 6 | * it under the terms of the GNU General Public License as published by |
---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 8 | * (at your option) any later version. |
---|
| 9 | * |
---|
| 10 | * This program is distributed in the hope that it will be useful, |
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | * GNU General Public License for more details. |
---|
| 14 | * |
---|
| 15 | * You should have received a copy of the GNU General Public License |
---|
| 16 | * along with this program; if not, write to the Free Software |
---|
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 18 | * |
---|
| 19 | * Authors: William Jon McCann <mccann@jhu.edu> |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #include "config.h" |
---|
| 24 | |
---|
| 25 | #include <stdio.h> |
---|
| 26 | #include <string.h> |
---|
| 27 | #include <stdarg.h> |
---|
| 28 | #include <signal.h> |
---|
| 29 | #include <time.h> |
---|
| 30 | #include <unistd.h> |
---|
| 31 | |
---|
| 32 | #include <glib.h> |
---|
| 33 | #include <glib/gstdio.h> |
---|
| 34 | |
---|
| 35 | #include "gdm-profile.h" |
---|
| 36 | |
---|
| 37 | void |
---|
| 38 | _gdm_profile_log (const char *func, |
---|
| 39 | const char *note, |
---|
| 40 | const char *format, |
---|
| 41 | ...) |
---|
| 42 | { |
---|
| 43 | va_list args; |
---|
| 44 | char *str; |
---|
| 45 | char *formatted; |
---|
| 46 | char *prgname; |
---|
| 47 | |
---|
| 48 | if (format == NULL) { |
---|
| 49 | formatted = g_strdup (""); |
---|
| 50 | } else { |
---|
| 51 | va_start (args, format); |
---|
| 52 | formatted = g_strdup_vprintf (format, args); |
---|
| 53 | va_end (args); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | prgname = g_get_prgname(); |
---|
| 57 | |
---|
| 58 | if (func != NULL) { |
---|
| 59 | str = g_strdup_printf ("MARK: %s %s: %s %s", |
---|
| 60 | prgname ? prgname : "(null)", |
---|
| 61 | func, |
---|
| 62 | note ? note : "", |
---|
| 63 | formatted); |
---|
| 64 | } else { |
---|
| 65 | str = g_strdup_printf ("MARK: %s: %s %s", |
---|
| 66 | prgname ? prgname : "(null)", |
---|
| 67 | note ? note : "", |
---|
| 68 | formatted); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | g_free (formatted); |
---|
| 72 | |
---|
| 73 | g_access (str, F_OK); |
---|
| 74 | g_free (str); |
---|
| 75 | } |
---|