- Include the dist/capture.min.js file on any page you want to capture the errors and logs for
- Install globally with npm:
npm install -g openlog
- Start the open log server:
...and that's it! Now you can access your instance of OpenLog at http://127.0.0.1:4783. The default login credentials are:
username: openlog password: password
Configuration options for OpenLog are set in
/config.inc.json. To find where your copy of OpenLog is installed, run the following command:
$ npm root -g > /usr/local/lib/node_modules
This command returns the path where global npm packages are installed on your machine. Once you know this path, you can visit the OpenLog directory with:
cd <insert_node_path_here>/openlog. You can then modify the
|Username||Username used to access the admin panel with. Default:
|Password||Password used to access the admin panel with. Default:
|Port||The server port that the OpenLog admin panel runs on. Default:
Once you have modified those values you can build your own version of OpenLog by running these commands in the root OpenLog directory:
npm install -g grunt-cli npm install grunt build
Amungst other things, this will build a new
dist/capture.min.js file. It's now simply a matter of including this new file on your HTML pages, and starting up the OpenLog server again with your new compiled settings.
If you are already logging using
console.error then OpenLog requires no extra work at all. It will capture errors globally on your page and listen to calls to the above
console functions. Alternatively, if you don't want to explicitly log information to the clients console, you can use OpenLog's built in methods:
Log is a globally defined object by the
If you don't want to capture certain logging types you simply add a
data-capture parameter to the script tag that loaded the
capture.min.js file and set it to be the types of logs you wish to capture. For instance, if you only want error logs:
...or if you want error and warning logs
data-capture="warn error" etc etc.
By default, OpenLog assumes that the dashboard is running on the same domain as the frontend it sends logs from (default port is 4783). To change this, you can specify the logging URL by setting a
data-log-url="" attribute on the script tag that loaded the
Fancy, smooth, no data loss updating method coming soon :)
All PR's and issues are welcomed with open arms.
- Fork this repository.
- Create a new branch:
git checkout -b my-new-feature.
- Make your changes and add some commits.
- Push your changes to GitHub and send in a pull request to this repository.
Samuel Attard - email@example.com - https://twitter.com/marshallofsound - https://www.samuelattard.com
OpenLog is licensed under the MIT License - see the LICENSE file for details.