+sub contexts {
+ my $self = shift;
+
+ my %contexts = map { $_ => 1 } @default_contexts;
+
+ $contexts{ $_->context } = 1
+ for qsearch({
+ select => 'DISTINCT context AS context',
+ table => 'log_context',
+ hashref => {},
+ });
+
+ sort { lc $a cmp lc $b } keys %contexts;
+}