You should refrain from hacking core.
Rather add this code to your sub theme's template.php file:
function MYTHEME_button(&$variables) {
dpm($variables);
$element = $variables['element'];
$label = $element['#value'];
element_set_attributes($element, array('id', 'name', 'value', 'type'));
// If a button type class isn't present then add in default.
$button_classes = array(
'btn-default',
'btn-primary',
'btn-success',
'btn-info',
'btn-warning',
'btn-danger',
'btn-link',
);
$class_intersection = array_intersect($button_classes, $element['#attributes']['class']);
if ($variables['element']['#type'] == 'submit' && $variables['element']['#value'] == 'Log in') {
$element['#attributes']['class'][] = 'btn-primary';
}
else if (empty($class_intersection)) {
$element['#attributes']['class'][] = 'btn-default';
}
// Add in the button type class.
$element['#attributes']['class'][] = 'form-' . $element['#button_type'];
// This line break adds inherent margin between multiple buttons.
// dpm($variables);
return '<button' . drupal_attributes($element['#attributes']) . '>' . $label . "</button>\n";
}
Bootstrap theme overrides the theme_button, and this is where I copied this code (minus the alteration of adding the class). We then override Bootstrap's implementation with our own.
The code that adds the class is this part:
if ($variables['element']['#type'] == 'submit' && $variables['element']['#value'] == 'Log in') {
$element['#attributes']['class'][] = 'btn-primary';
}
It's perhaps no the best way to detect that specific button (going on type and text), but it works.