Skip to content

Commit

Permalink
Add some slight bling to the log console and also add another develop…
Browse files Browse the repository at this point in the history
…er doc to the core plugin
  • Loading branch information
gashcrumb committed Oct 23, 2013
1 parent 1575565 commit 64cd373
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
37 changes: 37 additions & 0 deletions hawtio-web/src/main/webapp/app/core/doc/coreDeveloper.md
@@ -0,0 +1,37 @@
### Core plugin features

#### User Notifications

Notifications are provided by toastr.js. In hawtio there's a simple function that wraps invoking toastr so it's pretty easy to pop up a notification:

```
notification('error', 'Oh no!');
notification('warning', 'Better watch out!');
```

The available levels are 'info', 'success', 'warning' and 'error'.


#### Logging

Logging in hawtio plugins can be done either by using console.* functions or by using hawtio's Logging service. In either case logs are routed to hawtio's logging console as well as the javascript console. The log level is controlled in the preferences page.

The logging API is consistent with many other log APIs out there, for example:

```
Logger.info("Some log at info level");
Logger.warn("Oh snap!");
```

The Logger object has 4 levels it can log at, debug, info, warn and error. In hawtio messages logged at either warn or error will result in a notification.

It's also possible to create a named logger. Named loggers just prefix the log statements, for example:

```
Logger.get('MyPlugin').debug('Hey, something happened!');
```





1 change: 1 addition & 0 deletions hawtio-web/src/main/webapp/app/core/js/corePlugin.ts
Expand Up @@ -356,6 +356,7 @@ angular.module('hawtioCore', ['bootstrap', 'ngResource', 'ui', 'ui.bootstrap.dia
helpRegistry.addSubTopic('index', 'faq', 'app/core/doc/FAQ.md');
helpRegistry.addSubTopic('index', 'changes', 'app/core/doc/CHANGES.md');
helpRegistry.addSubTopic('index', 'developer', 'app/core/doc/developer.md');
helpRegistry.addDevDoc('Core', 'app/core/doc/coreDeveloper.md');
helpRegistry.discoverHelpFiles(hawtioPluginLoader.getModules());

var opts = localStorage['CodeMirrorOptions'];
Expand Down
6 changes: 5 additions & 1 deletion hawtio-web/src/main/webapp/css/site-base.css
Expand Up @@ -49,6 +49,11 @@ a:focus {
font-family: monospace;
margin-left: 3px;
margin-right: 3px;
transition: background .25s ease-in-out;
}

#log-panel-statements li:hover {
background: #111111;
}

#log-panel-statements li.DEBUG {
Expand All @@ -67,7 +72,6 @@ a:focus {
color: red;
}


#log-panel #close {
text-align: center;
position: absolute;
Expand Down

0 comments on commit 64cd373

Please sign in to comment.