File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -17,5 +17,8 @@ The config object to be passed to each service has the following properties:
17
17
- none: perform no logging
18
18
- REMOTE_LOGGING_ENDPOINT: the full URL to the endpoint where log messages are sent via AJAX POST
19
19
- REMOTE_ERROR_REPORT_ENDPOINT: the full URL to the endpoint where user error reports will be sent via AJAX POST
20
+ - LOGGING_LEVEL (can be debug|error)
21
+ - debug: log both debug and error messages
22
+ - error: only log error messages (debug messages are not logged)
20
23
21
24
The config object should be declared as an AngularJS constant named LOGGING_CONFIG.
Original file line number Diff line number Diff line change @@ -113,22 +113,24 @@ loggingModule.factory(
113
113
}
114
114
} ,
115
115
debug : function ( message ) {
116
- if ( LOGGING_CONFIG . LOGGING_TYPE !== 'none' ) {
117
- $log . log . apply ( $log , arguments ) ;
118
- }
116
+ if ( LOGGING_CONFIG . LOGGING_LEVEL !== 'error' ) {
117
+ if ( LOGGING_CONFIG . LOGGING_TYPE !== 'none' ) {
118
+ $log . log . apply ( $log , arguments ) ;
119
+ }
119
120
120
- // check if the config says we should log to the remote, and also if a remote endpoint was specified
121
- if ( LOGGING_CONFIG . LOGGING_TYPE === 'remote' && LOGGING_CONFIG . REMOTE_LOGGING_ENDPOINT ) {
122
- $ . ajax ( {
123
- type : "POST" ,
124
- url : LOGGING_CONFIG . REMOTE_LOGGING_ENDPOINT ,
125
- contentType : "application/json" ,
126
- data : angular . toJson ( {
127
- url : $window . location . href ,
128
- message : message ,
129
- type : "debug"
130
- } )
131
- } ) ;
121
+ // check if the config says we should log to the remote, and also if a remote endpoint was specified
122
+ if ( LOGGING_CONFIG . LOGGING_TYPE === 'remote' && LOGGING_CONFIG . REMOTE_LOGGING_ENDPOINT ) {
123
+ $ . ajax ( {
124
+ type : "POST" ,
125
+ url : LOGGING_CONFIG . REMOTE_LOGGING_ENDPOINT ,
126
+ contentType : "application/json" ,
127
+ data : angular . toJson ( {
128
+ url : $window . location . href ,
129
+ message : message ,
130
+ type : "debug"
131
+ } )
132
+ } ) ;
133
+ }
132
134
}
133
135
}
134
136
} ) ;
You can’t perform that action at this time.
0 commit comments