Giter Club home page Giter Club logo

saber-log's Introduction

saber-log Build Status

saber框架监控日志模块

Installation

通过 edp 引入模块:

edp import saber-log

Usage

var logger = require('saber-log');

// 设置日志地址
logger.setLogUrl('xxxx');
// 发送日志
logger.sendLog({name: 'helloworld'});

API

Methods

setLogUrl(url)

设置日志发送域名。

  • url {string} URL

setDefaultLog(options)

设置日志默认参数。这些参数在每次发送时都会被带上,因此常用来设置基本不变的值,例如和应用相关的信息

  • options {Object} 日志参数

sendLog(options)

手动发送一条日志。参数options会与和.setDefaultLog的参数合并,如果相同以.sendLog为准。常用来发送pv日志。点击日志由属性data-log,data-click等自行识别发送,不需要手动调用发送

  • options {Object} 日志参数

on()

为当前document.body绑定点击(click)事件,用以自行识别并发送日志。对于普通应用,在新页面载入时调用一次。对于单页应用(如saber),全局调用一次即可

un()

为当前document.body解绑点击(click)事件。

Test

启动测试服务器

$ node test/server.js

默认端口为8848,可以通过参数修改:

$ node test/server.js 8080

访问http://localhost:8848/test/runner.html

saber-log's People

Contributors

easonyq avatar treelite avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.