Definitions for jquery.clientSideLogging #218

This commit is contained in:
Diullei Gomes
2013-01-26 19:44:41 -02:00
parent d43bec3268
commit 026932eeab
3 changed files with 49 additions and 0 deletions
+1
View File
@@ -67,6 +67,7 @@ List of Definitions
* [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
* [jQuery.clientSideLogging](https://github.com/remybach/jQuery.clientSideLogging/) (by [Diullei Gomes](https://github.com/diullei/))
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
* [jQuery.dynatree](http://code.google.com/p/dynatree/) (by [François de Campredon](https://github.com/fdecampredon))
* [jQuery.Flot](http://www.flotcharts.org/) (by [Matt Burland](https://github.com/burlandm))
@@ -0,0 +1,24 @@
///<reference path="jquery.clientSideLogging.d.ts" />
interface JQueryStatic {
info: (what?: any) => any;
error: (what?: any) => any;
log: (what?: any) => any;
clientSideLogging: (options: ClientSideLoggingObject) => any;
}
$.clientSideLogging({
log_level: 3,
client_info: {
location:true,
screen_size:true,
user_agent:true,
window_size:false
}
});
$.info({msg:$(this).parents('li').find('input:text').val()});
$.error({msg:$(this).parents('li').find('input:text').val()});
$.log($(this).parents('li').find('input:text').val());
$.post('/log?type=error&msg=YOUR_ERROR_MESSAGE');
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for jquery.clientSideLogging.
// Project: https://github.com/remybach/jQuery.clientSideLogging
// Definitions by: Diullei Gomes <https://github.com/diullei>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface ClientSideLoggingClientInfoObject {
location?: bool; // The url to the page on which the error occurred.
screen_size?: bool; // The size of the user's screen (different to the window size because the window might not be maximized)
user_agent?: bool; // The user agent string.
window_size?: bool; // The window size.
}
interface ClientSideLoggingObject {
error_url?: string; // The url to which errors logs are sent
info_url?: string; // The url to which info logs are sent
log_url?: string; // The url to which standard logs are sent
log_level?: number; // The level at which to log. This allows you to keep the calls to the logging in your code and just change this variable to log varying degrees. 1 = only error, 2 = error & log, 3 = error, log & info
native_error?: bool; // Whether or not to send native js errors as well (using window.onerror).
hijack_console?: bool; // Hijacks the default console functionality (ie: all your console.error/info/log are belong to us).
query_var?: string; // The variable to send the log message through as.
client_info?: ClientSideLoggingClientInfoObject; // Configuration for what info about the client's browser is logged.
}