Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
Renamed console.js to browser-console.js, since the name was already …
Browse files Browse the repository at this point in the history
…reserved on npm
  • Loading branch information
Mickaël Tricot committed Aug 6, 2015
1 parent 886becc commit 029b725
Show file tree
Hide file tree
Showing 7 changed files with 921 additions and 921 deletions.
6 changes: 3 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function (grunt) {
"use strict";

var source = "lib/console.js",
var source = "lib/browser-console.js",
tests = "tests/*.js",
config = {};

Expand All @@ -27,11 +27,11 @@ module.exports = function (grunt) {
config.uglify = {
console: {
files: {
"lib/console.min.js": source
"lib/browser-console.min.js": source
},
options: {
sourceMap: true,
sourceMapName: "lib/console.min.js.map"
sourceMapName: "lib/browser-console.min.js.map"
}
}
};
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# console.js [![Build Status](https://travis-ci.org/mickaeltr/console.js.svg?branch=master)](https://travis-ci.org/mickaeltr/console.js)
# browser-console.js [![Build Status](https://travis-ci.org/mickaeltr/browser-console.js.svg?branch=master)](https://travis-ci.org/mickaeltr/browser-console.js)

JavaScript console that sends logs and unexpected errors to a remote server.
JavaScript console that sends logs and unexpected browser errors to a remote server.

## Why?

You have plenty of logs for your server-side applications but you do not know much about your client-side. You need to know what is happening there too.

## Usage

Insert [console.js](https://github.com/mickaeltr/console.js), initialize the console and play with it:
Insert [browser-console.js](https://github.com/mickaeltr/browser-console.js), initialize the console and play with it:

```html
<script src="lib/console.js"></script>
<script src="lib/browser-console.js"></script>
<script>
console.init({
serverUrl: "/logs"
});
console.warn("Writes a warning log in the JS console and sends it to the server", new Error("Oops"));
console.warn("Writes a warning log in the browser console and sends it to the server", new Error("Oops"));
console.xxxx("Sends an unexpected JS error to the server, as there is no 'xxxx' level/method");
</script>
```
Expand All @@ -26,7 +26,7 @@ The following requests will be sent (`POST`) to the server URL (`/logs`):
```json
{
"level": "warn",
"message": "Writes a warning log in the JS console and sends it to the server, Error: Oops!"
"message": "Writes a warning log in the browser console and sends it to the server, Error: Oops!"
}
```

Expand All @@ -44,7 +44,7 @@ Referer: http://localhost:1337/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0
```

Your server needs to handle `POST` requests on the server URL and exploit the logs. See a node.js example at `server/server.js`.
Your server needs to handle `POST` requests on the server URL and exploit the logs. See a Node.js example at `server/server.js`.

## Configuration

Expand Down Expand Up @@ -85,7 +85,7 @@ Optionally insert [stacktrace.js](https://github.com/stacktracejs/stacktrace.js)
```json
{
"level": "warn",
"message": "Writes a warning log in the JS console and sends it to the server, Error: Oops!",
"message": "Writes a warning log in the browser console and sends it to the server, Error: Oops!",
"stackTrace": "{anonymous}()@http://localhost:1337/:15"
}
```
Expand All @@ -102,7 +102,7 @@ and [window.onerror](http://www.w3.org/html/wg/drafts/html/master/webappapis.htm

### Run unit tests

#### In the console
#### In the terminal

```bash
grunt jasmine
Expand Down
Loading

0 comments on commit 029b725

Please sign in to comment.