~robert-ancell/lightdm/multiseat-logging-whitespace

« back to all changes in this revision

Viewing changes to src/seat.c

  • Committer: a7x
  • Date: 2013-08-04 07:11:52 UTC
  • Revision ID: ubuntu-a7x@scientician.org-20130804071152-gmskz7ajajavbga5
have Seat implement the Logger interface

This is a step toward logging the seat name in each Seat log message,
which will make it easier to debug multiseat setups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
#define USER_SERVICE      "lightdm"
64
64
#define AUTOLOGIN_SERVICE "lightdm-autologin"
65
65
 
66
 
G_DEFINE_TYPE (Seat, seat, G_TYPE_OBJECT);
 
66
static void seat_logger_iface_init (LoggerInterface *iface);
 
67
 
 
68
G_DEFINE_TYPE_WITH_CODE (Seat, seat, G_TYPE_OBJECT,
 
69
                         G_IMPLEMENT_INTERFACE (
 
70
                             LOGGER_TYPE, seat_logger_iface_init));
67
71
 
68
72
typedef struct
69
73
{
1603
1607
                      NULL,
1604
1608
                      G_TYPE_NONE, 0);
1605
1609
}
 
1610
 
 
1611
static gint
 
1612
seat_real_logprefix (Logger *self, gchar *buf, gulong buflen)
 
1613
{
 
1614
    Seat *seat = SEAT (self);
 
1615
    return g_snprintf (buf, buflen, "Seat %s: ",
 
1616
                       seat_get_string_property (seat, "seat-name"));
 
1617
}
 
1618
 
 
1619
static void
 
1620
seat_logger_iface_init (LoggerInterface *iface)
 
1621
{
 
1622
    iface->logprefix = &seat_real_logprefix;
 
1623
}