Skip to content

Commit 8689b50

Browse files
committed
glib: Finish adding all structured logging functions
1 parent 9b0fa96 commit 8689b50

File tree

6 files changed

+542
-46
lines changed

6 files changed

+542
-46
lines changed

glib/Gir.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ generate = [
2020
"GLib.KeyFileError",
2121
"GLib.KeyFileFlags",
2222
"GLib.LogLevelFlags",
23+
"GLib.LogWriterOutput",
2324
"GLib.MainContextFlags",
2425
"GLib.OptionArg",
2526
"GLib.OptionFlags",

glib/src/auto/enums.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,64 @@ impl ErrorDomain for KeyFileError {
354354
}
355355
}
356356

357+
#[cfg(any(feature = "v2_50", feature = "dox"))]
358+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
359+
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
360+
#[non_exhaustive]
361+
#[doc(alias = "GLogWriterOutput")]
362+
pub enum LogWriterOutput {
363+
#[doc(alias = "G_LOG_WRITER_HANDLED")]
364+
Handled,
365+
#[doc(alias = "G_LOG_WRITER_UNHANDLED")]
366+
Unhandled,
367+
#[doc(hidden)]
368+
__Unknown(i32),
369+
}
370+
371+
#[cfg(any(feature = "v2_50", feature = "dox"))]
372+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
373+
impl fmt::Display for LogWriterOutput {
374+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
375+
write!(
376+
f,
377+
"LogWriterOutput::{}",
378+
match *self {
379+
Self::Handled => "Handled",
380+
Self::Unhandled => "Unhandled",
381+
_ => "Unknown",
382+
}
383+
)
384+
}
385+
}
386+
387+
#[cfg(any(feature = "v2_50", feature = "dox"))]
388+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
389+
#[doc(hidden)]
390+
impl IntoGlib for LogWriterOutput {
391+
type GlibType = ffi::GLogWriterOutput;
392+
393+
fn into_glib(self) -> ffi::GLogWriterOutput {
394+
match self {
395+
Self::Handled => ffi::G_LOG_WRITER_HANDLED,
396+
Self::Unhandled => ffi::G_LOG_WRITER_UNHANDLED,
397+
Self::__Unknown(value) => value,
398+
}
399+
}
400+
}
401+
402+
#[cfg(any(feature = "v2_50", feature = "dox"))]
403+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
404+
#[doc(hidden)]
405+
impl FromGlib<ffi::GLogWriterOutput> for LogWriterOutput {
406+
unsafe fn from_glib(value: ffi::GLogWriterOutput) -> Self {
407+
match value {
408+
ffi::G_LOG_WRITER_HANDLED => Self::Handled,
409+
ffi::G_LOG_WRITER_UNHANDLED => Self::Unhandled,
410+
value => Self::__Unknown(value),
411+
}
412+
}
413+
}
414+
357415
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
358416
#[non_exhaustive]
359417
#[doc(alias = "GOptionArg")]

glib/src/auto/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub use self::enums::ChecksumType;
3535
pub use self::enums::DateMonth;
3636
pub use self::enums::DateWeekday;
3737
pub use self::enums::KeyFileError;
38+
#[cfg(any(feature = "v2_50", feature = "dox"))]
39+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_50")))]
40+
pub use self::enums::LogWriterOutput;
3841
pub use self::enums::OptionArg;
3942
pub use self::enums::SeekType;
4043
pub use self::enums::TimeType;

glib/src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,24 @@ pub use self::quark::Quark;
129129
mod log;
130130
pub use self::log::log_set_handler;
131131

132-
// #[cfg(any(feature = "v2_50", feature = "dox"))]
133-
// pub use log::log_variant;
134132
pub use self::log::{
135133
log_default_handler, log_remove_handler, log_set_always_fatal, log_set_default_handler,
136134
log_set_fatal_mask, log_unset_default_handler, set_print_handler, set_printerr_handler,
137135
unset_print_handler, unset_printerr_handler, LogHandlerId, LogLevel, LogLevels,
138136
};
139137

138+
#[cfg(any(feature = "v2_50", feature = "dox"))]
139+
pub use self::log::{
140+
log_set_writer_func, log_structured_array, log_variant, log_writer_default,
141+
log_writer_format_fields, log_writer_journald, log_writer_standard_streams, LogField,
142+
};
143+
144+
#[cfg(any(all(unix, feature = "v2_50"), feature = "dox"))]
145+
pub use self::log::{log_writer_is_journald, log_writer_supports_color};
146+
147+
#[cfg(any(feature = "v2_68", feature = "dox"))]
148+
pub use self::log::{log_writer_default_set_use_stderr, log_writer_default_would_drop};
149+
140150
#[doc(hidden)]
141151
#[cfg(any(feature = "dox", feature = "log_macros"))]
142152
#[cfg_attr(feature = "dox", doc(cfg(feature = "log_macros")))]

0 commit comments

Comments
 (0)