Skip to content

Commit

Permalink
first public version of logged exceptions plugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.techno-weenie.net/projects/plugins/exception_logger@1271 567b1171-46fb-0310-a4c9-b4bef9110e78
  • Loading branch information
technoweenie committed Jun 24, 2006
0 parents commit e33986d
Show file tree
Hide file tree
Showing 22 changed files with 820 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,4 @@
ExceptionLogger
===============

Description goes here
22 changes: 22 additions & 0 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

desc 'Default: run unit tests.'
task :default => :test

desc 'Test the exception_logger plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

desc 'Generate documentation for the exception_logger plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ExceptionLogger'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
28 changes: 28 additions & 0 deletions assets/exception_logger.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,28 @@
ExceptionLogger = {
filters: ['exception_names', 'controller_actions', 'date_ranges'],
setPage: function(num) {
$('page').value = num;
$('query-form').onsubmit();
},

setFilter: function(context, name) {
var filterName = context + '_filter'
$(filterName).value = ($F(filterName) == name) ? '' : name;
this.deselect(context, filterName);
$('page').value = '1';
$('query-form').onsubmit();
},

deselect: function(context, filterName) {
$$('#' + context + ' a').each(function(a) {
var value = $(filterName) ? $F(filterName) : null;
a.className = (value && (a.getAttribute('title') == value || a.innerHTML == value)) ? 'selected' : '';
});
}
}

Event.observe(window, 'load', function() {
ExceptionLogger.filters.each(function(context) {
$(context + '_filter').value = '';
});
});
292 changes: 292 additions & 0 deletions assets/style.css
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,292 @@
body
{
margin:0;
padding:0;
background:#000;
font-family:'Lucida Grande', Arial, Helvetica, sans-serif;
font-size:1.0em;
color:white;
}

#container
{
xwidth:95%;
margin:0 auto;
min-width:800px;
}

#left
{
xfloat:left;
xwidth:76%;
margin-right:235px;

}

#left .page
{
font-size:0.9em;
background:white;
border:2px solid #999;
border-width:0 2px 2px 0;
padding:25px;
xmargin-bottom:1em;
color:black;
}

#right
{
margin-top:1em;
float:right;
xwidth:22%;
font-size:0.9em;
width:200px;
margin-right:1.25em;
}

#right hr
{
border:0;
border-top:1px solid #222;
}

#search
{
margin-top:2em;
background:#111;
padding:10px 5px;
border:1px solid #222;
border-width:1px 0;
}


ul.filters
{
list-style-type:none;
padding:0;
margin:0;
font-size:0.9em;
}
ul.filters li { margin-bottom:0.2em;}


ul.filters a,
ul.filters a:visited {
display:block;
padding:1px 7px;
color:#fff;
xbackground-color:#fff;
text-decoration:none;
}

ul.filters a:hover
{
background:#666;
color:white;
}

ul.filters a.selected,
ul.filters a.selected:visited,
ul.filters a:active {
color:gold;
background-color:#333;
text-decoration:none;
font-weight:bold;
}


onclick a:hover
{
color:#fff;
text-decoration:none;
}

#exceptions table
{
width:99%;
border-collapse:collapse;
}

td
{
padding:5px 10px;
xborder:1px solid #ddd;
}

#backtrace
{
overflow:auto;
font-family:"Bitstream Vera Sans Mono", "Monaco", "Courier", monospace;;
font-size:0.85em;
margin-top:0.25em;
}

h2
{
background-color:#ddd;
font-size:0.8em;
padding:3px 10px;
}

form {margin:0;}

h3 {
font-size:0.8em;
color:#ddd;
background:#222;
padding:3px 7px;
}

div.date
{
color:#666;
font-size:0.8em;
}

h1
{
margin-top:0.25em;
font-size:1.25em;
padding-bottom:5px;
border-bottom:2px solid #ddd;
}

h1 span
{
color:#aaa;
font-weight:normal;
}

a
{
color:#369;
text-decoration:none;
}
a:hover
{
color:blue;
text-decoration:underline;
}

th
{
text-align:left;
xbackground:#333;
xcolor:gold;
font-size:0.75em;
padding:2px 10px;
}

tr { xcursor:pointer; }

tr.eor td
{
background:#e7e7e7;

}

/*
tr:hover td,
tr.eor:hover td
{
background:#333;
color:white;
}
tr:hover td a,
tr.eor:hover td a { color:gold; }
*/

.message
{
font-size:0.8em;
}

a.util
{
color:#c00;
font-size:0.7em;
}

.pipe
{
font-size:0.75em;
color:#999;
}

.tools { float:right; }

.time
{
color:#666;
font-size:0.75em;
xvertical-align:top;
}


.expclass
{
xcolor:#999;
}
.expclass a
{
font-size:0.9em;
}

tr.deleted td {
color:#aaa;
text-decoration: line-through;
}
tr.deleted td a { color:#aaa; }

.pages { float:right; margin-right:1em; }
.pages a { text-decoration:underline; }
.pages-bottom { border-top:2px solid #ddd; text-align:right; float:none;
padding-top:0.4em;
margin-top:0.4em;
padding-right:1em;
margin-right:0;
}

/* right */

#right h4
{
font-size:0.75em;
xbackground:#171717;
xbackground:#333;
color:#999;
padding:3px 5px;
margin-bottom:0.5em;
font-weight:normal;
}

/* tabs */

ul.tabs
{
list-style-type:none;
padding:0;
margin:1em 0;
float:left;
}
ul.tabs li { float:left; display:inline; }
ul.tabs li a
{
font-size:0.8em;
padding:3px 7px;
margin-right:1em;
text-decoration:none;
color:black;
}

ul.tabs li a:hover
{
background:#666;
color:white;
}
ul.tabs li.selected a
{
background:black;
color:white;
}

14 changes: 14 additions & 0 deletions generators/exception_migration/USAGE
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,14 @@
Description:
The exception migration generator creates a migration for the logged exceptions model.

The generator takes a migration name as its argument. The migration name may be
given in CamelCase or under_score. 'add_exception_table' is the default.

The generator creates a migration class in db/migrate prefixed by its number
in the queue.

Example:
./script/generate exception_migration add_exception_table

With 4 existing migrations, this will create an AddExceptionTable migration in the
file db/migrate/5_add_exception_table.rb
14 changes: 14 additions & 0 deletions generators/exception_migration/exception_migration_generator.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,14 @@
class ExceptionMigrationGenerator < Rails::Generator::NamedBase
attr_reader :exception_table_name
def initialize(runtime_args, runtime_options = {})
@exception_table_name = (runtime_args.length < 2 ? 'logged_exceptions' : runtime_args[1]).tableize
runtime_args << 'add_exception_table' if runtime_args.empty?
super
end

def manifest
record do |m|
m.migration_template 'migration.rb', 'db/migrate'
end
end
end
Loading

0 comments on commit e33986d

Please sign in to comment.