aboutsummaryrefslogtreecommitdiffstats
path: root/libfsoframework/fsoframework/logger.h
blob: 2abb0e3e02b532dc684a13e2afbe4e5de5cd2087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
 * Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 */

#ifndef __FSOFRAMEWORK_LOGGER_H__
#define __FSOFRAMEWORK_LOGGER_H__

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>

G_BEGIN_DECLS


#define FSO_FRAMEWORK_TYPE_ABSTRACT_LOGGER (fso_framework_abstract_logger_get_type ())
#define FSO_FRAMEWORK_ABSTRACT_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_FRAMEWORK_TYPE_ABSTRACT_LOGGER, FsoFrameworkAbstractLogger))
#define FSO_FRAMEWORK_ABSTRACT_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_FRAMEWORK_TYPE_ABSTRACT_LOGGER, FsoFrameworkAbstractLoggerClass))
#define FSO_FRAMEWORK_IS_ABSTRACT_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_FRAMEWORK_TYPE_ABSTRACT_LOGGER))
#define FSO_FRAMEWORK_IS_ABSTRACT_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_FRAMEWORK_TYPE_ABSTRACT_LOGGER))
#define FSO_FRAMEWORK_ABSTRACT_LOGGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_FRAMEWORK_TYPE_ABSTRACT_LOGGER, FsoFrameworkAbstractLoggerClass))

typedef struct _FsoFrameworkAbstractLogger FsoFrameworkAbstractLogger;
typedef struct _FsoFrameworkAbstractLoggerClass FsoFrameworkAbstractLoggerClass;
typedef struct _FsoFrameworkAbstractLoggerPrivate FsoFrameworkAbstractLoggerPrivate;

#define FSO_FRAMEWORK_TYPE_FILE_LOGGER (fso_framework_file_logger_get_type ())
#define FSO_FRAMEWORK_FILE_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_FRAMEWORK_TYPE_FILE_LOGGER, FsoFrameworkFileLogger))
#define FSO_FRAMEWORK_FILE_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_FRAMEWORK_TYPE_FILE_LOGGER, FsoFrameworkFileLoggerClass))
#define FSO_FRAMEWORK_IS_FILE_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_FRAMEWORK_TYPE_FILE_LOGGER))
#define FSO_FRAMEWORK_IS_FILE_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_FRAMEWORK_TYPE_FILE_LOGGER))
#define FSO_FRAMEWORK_FILE_LOGGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_FRAMEWORK_TYPE_FILE_LOGGER, FsoFrameworkFileLoggerClass))

typedef struct _FsoFrameworkFileLogger FsoFrameworkFileLogger;
typedef struct _FsoFrameworkFileLoggerClass FsoFrameworkFileLoggerClass;
typedef struct _FsoFrameworkFileLoggerPrivate FsoFrameworkFileLoggerPrivate;

/**
 * AbstractLogger
 */
struct _FsoFrameworkAbstractLogger {
	GObject parent_instance;
	FsoFrameworkAbstractLoggerPrivate * priv;
	guint level;
	char* domain;
	char* destination;
};

struct _FsoFrameworkAbstractLoggerClass {
	GObjectClass parent_class;
	void (*write) (FsoFrameworkAbstractLogger* self, const char* message);
};

/**
 * FileLogger
 */
struct _FsoFrameworkFileLogger {
	FsoFrameworkAbstractLogger parent_instance;
	FsoFrameworkFileLoggerPrivate * priv;
};

struct _FsoFrameworkFileLoggerClass {
	FsoFrameworkAbstractLoggerClass parent_class;
};


void fso_framework_abstract_logger_write (FsoFrameworkAbstractLogger* self, const char* message);
FsoFrameworkAbstractLogger* fso_framework_abstract_logger_construct (GType object_type, const char* domain);
FsoFrameworkAbstractLogger* fso_framework_abstract_logger_new (const char* domain);
void fso_framework_abstract_logger_setLevel (FsoFrameworkAbstractLogger* self, GLogLevelFlags level);
void fso_framework_abstract_logger_setDestination (FsoFrameworkAbstractLogger* self, const char* destination);
void fso_framework_abstract_logger_debug (FsoFrameworkAbstractLogger* self, const char* message);
void fso_framework_abstract_logger_info (FsoFrameworkAbstractLogger* self, const char* message);
void fso_framework_abstract_logger_warning (FsoFrameworkAbstractLogger* self, const char* message);
void fso_framework_abstract_logger_error (FsoFrameworkAbstractLogger* self, const char* message);
GType fso_framework_abstract_logger_get_type (void);
FsoFrameworkFileLogger* fso_framework_file_logger_construct (GType object_type, const char* domain);
FsoFrameworkFileLogger* fso_framework_file_logger_new (const char* domain);
void fso_framework_file_logger_setFile (FsoFrameworkFileLogger* self, const char* filename, gboolean append);
GType fso_framework_file_logger_get_type (void);


G_END_DECLS

#endif