---
name: "Glib::Log"
section: "3pm"
platform: "linux"
package: "glib-perl"
version: "1.329.4-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Glib::Log"
---

# Glib::Log(3pm)

A flexible logging mechanism

## NAME

Glib::Log -  A flexible logging mechanism

## METHODS

### scalar = Glib::Log-\>set\_always\_fatal ($fatal\_mask)

- •

  `$fatal_mask` (scalar)

### Glib-\>critical ($domain, $message)

- •

  `$domain` (string or undef)

- •

  `$message` (string)

### Glib-\>debug ($domain, $message)

- •

  `$domain` (string or undef)

- •

  `$message` (string)

### Glib::Log::default\_handler ($log\_domain, $log\_level, $message, ...)

- •

  `$log_domain` (string)

- •

  `$log_level` (scalar)

- •

  `$message` (string)

- •

  ... (list) possible "userdata" argument ignored

The arguments are the same as taken by the function for set\_handler or set\_default\_handler.

### prev\_log\_func = Glib::Log-\>set\_default\_handler ($log\_func, $user\_data)

- •

  `$log_func` (subroutine) handler function or undef

- •

  `$user_data` (scalar)

Install log\_func as the default log handler.  log\_func is called for anything which doesn't otherwise have a handler (either Glib::Log-\>set\_handler, or the Glib::xsapi gperl\_handle\_logs\_for),

```
    &$log_func ($log_domain, $log_levels, $message, $user_data)
```

where `$log_domain` is a string, and `$log_levels` is a Glib::LogLevelFlags of level and flags being reported.

If log\_func is \\&Glib::Log::default\_handler or undef then Glib's default handler is set.

The return value from `"set_default_handler"` is the previous handler. This is \\&Glib::Log::default\_handler for Glib's default, otherwise a Perl function previously installed.  If the handler is some other non-Perl function then currently the return is undef, but perhaps that will change to some wrapped thing, except that without associated userdata there's very little which could be done with it (it couldn't be reinstalled later without its userdata).

Since: glib 2.6

### Glib-\>error ($domain, $message)

- •

  `$domain` (string or undef)

- •

  `$message` (string)

### scalar = Glib::Log-\>set\_fatal\_mask ($log\_domain, $fatal\_mask)

- •

  `$log_domain` (string)

- •

  `$fatal_mask` (scalar)

### integer = Glib::Log-\>set\_handler ($log\_domain, $log\_levels, $log\_func, $user\_data=undef)

- •

  `$log_domain` (string or undef) name of the domain to handle with this callback.

- •

  `$log_levels` (Glib::LogLevelFlags) log levels to handle with this callback

- •

  `$log_func` (subroutine) handler function

- •

  `$user_data` (scalar)

`$log_func` will be called as

```
    &$log_func ($log_domain, $log_levels, $message, $user_data);
```

where `$log_domain` is the name requested and `$log_levels` is a Glib::LogLevelFlags of level and flags being reported.

### Glib-\>info ($domain, $message)

- •

  `$domain` (string or undef)

- •

  `$message` (string)

### Glib-\>log ($log\_domain, $log\_level, $message)

- •

  `$log_domain` (string or undef)

- •

  `$log_level` (scalar)

- •

  `$message` (string)

### Glib-\>message ($domain, $message)

- •

  `$domain` (string or undef)

- •

  `$message` (string)

### Glib::Log-\>remove\_handler ($log\_domain, $handler\_id)

- •

  `$log_domain` (string or undef)

- •

  `$handler_id` (integer) as returned by `"set_handler"`

### Glib-\>warning ($domain, $message)

- •

  `$domain` (string or undef)

- •

  `$message` (string)

## ENUMS AND FLAGS

### flags Glib::LogLevelFlags

- •

  'recursion' / 'G\_LOG\_FLAG\_RECURSION'

- •

  'fatal' / 'G\_LOG\_FLAG\_FATAL'

- •

  'error' / 'G\_LOG\_LEVEL\_ERROR'

- •

  'critical' / 'G\_LOG\_LEVEL\_CRITICAL'

- •

  'warning' / 'G\_LOG\_LEVEL\_WARNING'

- •

  'message' / 'G\_LOG\_LEVEL\_MESSAGE'

- •

  'info' / 'G\_LOG\_LEVEL\_INFO'

- •

  'debug' / 'G\_LOG\_LEVEL\_DEBUG'

- •

  'fatal-mask' / 'G\_LOG\_FATAL\_MASK'

## SEE ALSO

Glib

## COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL.  See Glib for a full notice.
