Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option/setting to exclude auto generated log entry body #2773

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ else if (adapterType.isAssignableFrom(LogEntry.class))
{
LogEntryBuilder log = log()
.title(LogbookPreferences.auto_title ? "Display Screenshot for : " + selectionInfo.getName() : "")
.appendDescription(getBody(selectionInfo));
.appendDescription(LogbookPreferences.auto_body ? getBody(selectionInfo) : "");
try
{
final File image_file = selectionInfo.getImage() == null ? null : new Screenshot(selectionInfo.getImage()).writeToTempfile("image");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.phoebus.framework.preferences.AnnotatedPreferences;
import org.phoebus.framework.preferences.Preference;
import org.phoebus.framework.preferences.PreferencesReader;

import java.util.logging.Level;

Expand All @@ -16,25 +15,24 @@ public class LogbookPreferences {
@Preference
public static boolean auto_title;
@Preference
public static boolean auto_body;
@Preference
public static boolean auto_property;

/** Is there support for a logbook?
* Is the 'logbook_factory' configured and available?
/**
* Is there support for a logbook?
* Is the 'logbook_factory' configured and available?
*/
public static boolean is_supported;

static
{
final PreferencesReader prefs = AnnotatedPreferences.initialize(LogbookPreferences.class, "/logbook_preferences.properties");
if (logbook_factory.isEmpty())
{
static {
AnnotatedPreferences.initialize(LogbookPreferences.class, "/logbook_preferences.properties");
if (logbook_factory.isEmpty()) {
is_supported = false;
logger.log(Level.INFO, "No logbook factory selected");
}
else
{
} else {
is_supported = LogService.getInstance().getLogFactories(logbook_factory) != null;
if (! is_supported)
if (!is_supported)
logger.log(Level.WARNING, "Cannot locate logbook factory '" + logbook_factory + "'");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ logbook_factory=inmemory
# should auto generate a title (e.g. "Display Screenshot...").
auto_title=true

# Determines if a log entry created from context menu (e.g. display or data browser)
# should auto generate a body (e.g. "Display Screenshot...").
auto_body=true

# Determines if a log entry created from context menu (e.g. display or data browser)
# should auto generate properties (e.g. "resources.file").
auto_property=false
Loading