search

Home  >  Q&A  >  body text

javascript - How to implement flv.js real-time monitoring output log

After looking at the uncompressed version of flv.js, I can't find the place where Log is called. How to implement real-time monitoring and output logs?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

<code>var Log = function () {

    function Log() {

        _classCallCheck(this, Log);

    }

 

    _createClass(Log, null, [{

        key: 'e',

        value: function e(tag, msg) {

            if (!Log.ENABLE_ERROR) {

                return;

            }

 

            if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG;

 

            var str = '[' + tag + '] > ' + msg;

 

            if (console.error) {

                console.error(str);

            } else if (console.warn) {

                console.warn(str);

            } else {

                console.log(str);

            }

        }

    }, {

        key: 'i',

        value: function i(tag, msg) {

            if (!Log.ENABLE_INFO) {

                return;

            }

 

            if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG;

 

            var str = '[' + tag + '] > ' + msg;

 

            if (console.info) {

                console.info(str);

            } else {

                console.log(str);

            }

        }

    }, {

        key: 'w',

        value: function w(tag, msg) {

            if (!Log.ENABLE_WARN) {

                return;

            }

 

            if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG;

 

            var str = '[' + tag + '] > ' + msg;

 

            if (console.warn) {

                console.warn(str);

            } else {

                console.log(str);

            }

        }

    }, {

        key: 'd',

        value: function d(tag, msg) {

            if (!Log.ENABLE_DEBUG) {

                return;

            }

 

            if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG;

 

            var str = '[' + tag + '] > ' + msg;

 

            if (console.debug) {

                console.debug(str);

            } else {

                console.log(str);

            }

        }

    }, {

        key: 'v',

        value: function v(tag, msg) {

            if (!Log.ENABLE_VERBOSE) {

                return;

            }

 

            if (!tag || Log.FORCE_GLOBAL_TAG) tag = Log.GLOBAL_TAG;

 

            console.log('[' + tag + '] > ' + msg);

        }

    }]);

 

    return Log;

}();

 

Log.GLOBAL_TAG = 'flv.js';

Log.FORCE_GLOBAL_TAG = false;

Log.ENABLE_ERROR = true;

Log.ENABLE_INFO = true;

Log.ENABLE_WARN = true;

Log.ENABLE_DEBUG = true;

Log.ENABLE_VERBOSE = true;

 

exports.default = Log;</code>

曾经蜡笔没有小新曾经蜡笔没有小新2746 days ago1159

reply all(1)I'll reply

  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-07-05 11:04:57

    The one with the exclamation mark and the yellow background is console.warn

    console.warn

    https://github.com/Bilibili/f...

    reply
    0
  • Cancelreply