Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ozmap/ozlogger

DevOZ logger module.
https://github.com/ozmap/ozlogger

logger nodejs typescript winston

Last synced: about 2 months ago
JSON representation

DevOZ logger module.

Awesome Lists containing this project

README

        

# OZLogger
DevOZ logger module.

----

## Available log methods
The available methods are presented in level hierarchy order.

- `.debug(...messages: any[])`
- `.audit(...messages: any[])`
- `.info(...messages: any[])`
- `.warn(...messages: any[])`
- `.error(...messages: any[])`

## Usage examples
Here is a simple code snippet example of using the OZLogger with typescript:

```typescript
import createLogger from '@ozmap/logger';

// Initialize and configure the logging facility
const OZLogger = createLogger();

// Example of simple debug log
OZLogger.debug("Simple test log");
```

If you are using the OZLogger with javascript:

```javascript
const createLogger = require('@ozmap/logger');

// Initialize and configure the logging facility
const OZLogger = createLogger();

// Example of simple debug log
OZLogger.debug("Simple test log");
```

The above snippet can even be improved to:

```javascript
// Initialize and configure the logging facility right after importing it
const OZLogger = require('@ozmap/logger')();

// Example of simple debug log
OZLogger.debug("Simple test log");
```

## Changing log levels

In order to change the log level at runtime the following
HTTP request can be made:

```
POST http://localhost:9898/changeLevel
{
"level": "",
"duration":
}
```

```curl
curl -L -X POST -H 'Content-Type: application/json' -d '{"level":"","duration":}' http://localhost:9898/changeLevel
```