mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1723] LogService configuration (#2496)
* log levels implementation * documentation and test * remove logservieMock * add logLevel in app config file * remove semicolons * fix pagination test * fix test form * silent test in production config * fix test
This commit is contained in:
committed by
Denys Vuika
parent
de8fa02ef7
commit
8b0047337f
@@ -369,7 +369,7 @@ for more information about installing and using the source code.
|
||||
- [*Discovery api service](../ng2-components/ng2-alfresco-core/src/services/discovery-api.service.ts)
|
||||
- [*Favorites api service](../ng2-components/ng2-alfresco-core/src/services/favorites-api.service.ts)
|
||||
- [*Highlight transform service](../ng2-components/ng2-alfresco-core/src/services/highlight-transform.service.ts)
|
||||
- [*Log service](../ng2-components/ng2-alfresco-core/src/services/log.service.ts)
|
||||
- [Log service](log.service.md)
|
||||
- [*Nodes api service](../ng2-components/ng2-alfresco-core/src/services/nodes-api.service.ts)
|
||||
- [*Page title service](../ng2-components/ng2-alfresco-core/src/services/page-title.service.ts)
|
||||
- [*People content service](../ng2-components/ng2-alfresco-core/src/services/people-content.service.ts)
|
||||
|
63
docs/log.service.md
Normal file
63
docs/log.service.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# Log Service
|
||||
|
||||
Provide a log functionality for your ADF application.
|
||||
|
||||
<!-- markdown-toc start - Don't edit this section. npm run toc to generate it-->
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Basic Usage](#basic-usage)
|
||||
* [Log levels](#log-levels)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
<!-- markdown-toc end -->
|
||||
|
||||
## Basic Usage
|
||||
|
||||
**app.component.ts**
|
||||
|
||||
```ts
|
||||
import { LogService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({...})
|
||||
export class AppComponent {
|
||||
|
||||
constructor(logService: LogService) {
|
||||
}
|
||||
|
||||
myMethod(){
|
||||
this.logService.error('My error');
|
||||
this.logService.trace('My trace')
|
||||
this.logService.debug('My debug')
|
||||
this.logService.info('My info')
|
||||
this.logService.warn('My warn')
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Log levels
|
||||
|
||||
The log service provide 6 level of logs:
|
||||
|
||||
Name | Level
|
||||
-|-
|
||||
TRACE |5
|
||||
DEBUG |4
|
||||
INFO |3
|
||||
WARN |2
|
||||
ERROR |1
|
||||
SILENT |0
|
||||
|
||||
You can configure the log level setting the ***logLevel*** properties in the **app.config.json**. By default the level is TRACE.
|
||||
|
||||
If you want set for example the log to warning:
|
||||
|
||||
**app.config.json**
|
||||
|
||||
```json
|
||||
{
|
||||
"logLevel": "WARN"
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user