1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
2 | /* |
3 | * Copyright (C) 2008 Red Hat, Inc. |
4 | */ |
5 | |
6 | #ifndef __SOUP_LOGGER_H__ |
7 | #define __SOUP_LOGGER_H__ 1 |
8 | |
9 | #include <libsoup/soup-types.h> |
10 | |
11 | G_BEGIN_DECLS |
12 | |
13 | #define SOUP_TYPE_LOGGER (soup_logger_get_type ()) |
14 | #define SOUP_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_LOGGER, SoupLogger)) |
15 | #define SOUP_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_LOGGER, SoupLoggerClass)) |
16 | #define SOUP_IS_LOGGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_LOGGER)) |
17 | #define SOUP_IS_LOGGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_LOGGER)) |
18 | #define SOUP_LOGGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_LOGGER, SoupLoggerClass)) |
19 | |
20 | typedef enum { |
21 | SOUP_LOGGER_LOG_NONE, |
22 | SOUP_LOGGER_LOG_MINIMAL, |
23 | , |
24 | SOUP_LOGGER_LOG_BODY |
25 | } SoupLoggerLogLevel; |
26 | |
27 | typedef struct { |
28 | GObject parent; |
29 | |
30 | } SoupLogger; |
31 | |
32 | typedef struct { |
33 | GObjectClass parent_class; |
34 | |
35 | /* Padding for future expansion */ |
36 | void (*_libsoup_reserved1) (void); |
37 | void (*_libsoup_reserved2) (void); |
38 | void (*_libsoup_reserved3) (void); |
39 | void (*_libsoup_reserved4) (void); |
40 | } SoupLoggerClass; |
41 | |
42 | typedef SoupLoggerLogLevel (*SoupLoggerFilter) (SoupLogger *logger, |
43 | SoupMessage *msg, |
44 | gpointer user_data); |
45 | |
46 | typedef void (*SoupLoggerPrinter) (SoupLogger *logger, |
47 | SoupLoggerLogLevel level, |
48 | char direction, |
49 | const char *data, |
50 | gpointer user_data); |
51 | |
52 | SOUP_AVAILABLE_IN_2_4 |
53 | GType soup_logger_get_type (void); |
54 | |
55 | #define SOUP_LOGGER_LEVEL "level" |
56 | #define SOUP_LOGGER_MAX_BODY_SIZE "max-body-size" |
57 | |
58 | SOUP_AVAILABLE_IN_2_4 |
59 | SoupLogger *soup_logger_new (SoupLoggerLogLevel level, |
60 | int max_body_size); |
61 | |
62 | #ifndef SOUP_DISABLE_DEPRECATED |
63 | SOUP_AVAILABLE_IN_2_4 |
64 | SOUP_DEPRECATED_IN_2_24_FOR(soup_session_add_feature) |
65 | void soup_logger_attach (SoupLogger *logger, |
66 | SoupSession *session); |
67 | SOUP_AVAILABLE_IN_2_4 |
68 | SOUP_DEPRECATED_IN_2_24_FOR(soup_session_remove_feature) |
69 | void soup_logger_detach (SoupLogger *logger, |
70 | SoupSession *session); |
71 | #endif |
72 | |
73 | SOUP_AVAILABLE_IN_2_4 |
74 | void soup_logger_set_request_filter (SoupLogger *logger, |
75 | SoupLoggerFilter request_filter, |
76 | gpointer filter_data, |
77 | GDestroyNotify destroy); |
78 | SOUP_AVAILABLE_IN_2_4 |
79 | void soup_logger_set_response_filter (SoupLogger *logger, |
80 | SoupLoggerFilter response_filter, |
81 | gpointer filter_data, |
82 | GDestroyNotify destroy); |
83 | |
84 | SOUP_AVAILABLE_IN_2_4 |
85 | void soup_logger_set_printer (SoupLogger *logger, |
86 | SoupLoggerPrinter printer, |
87 | gpointer printer_data, |
88 | GDestroyNotify destroy); |
89 | |
90 | G_END_DECLS |
91 | |
92 | #endif /* __SOUP_LOGGER_H__ */ |
93 | |