Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ericz991 committed Mar 5, 2024
1 parent 398c601 commit 6caff17
Showing 1 changed file with 63 additions and 10 deletions.
73 changes: 63 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,68 @@
# pkg-name
# Loggy

[![NPM version](https://img.shields.io/npm/v/pkg-name?color=a1b858&label=)](https://www.npmjs.com/package/pkg-name)
> Simplify logging in your application
## Sponsors
# Installation

<p align="center">
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
</a>
</p>
```bash
npm install loggy
```

## License
# Usage

[MIT](./LICENSE) License © 2022 [Anthony Fu](https://github.com/antfu)
```typescript

import { createLogger, Loggy } from 'loggy'

// You can use either to initialize an instance in 2 ways

// 1. one way
const logger = createLogger({
path: 'some-path',
formatMessageTemplate: '😊 ({TIME}) - ({LEVEL}) - >> {MESSAGE}',
backupDuration: 3600 * 1000 // 1 hour
shouldBackUp: true,
cloud: {
ut: {
apiKey: '...'
}
}
});

// 2. second way
const logger = new Loggy({
path: 'some-path',
formatMessageTemplate: '😊 ({TIME}) - ({LEVEL}) - >> {MESSAGE}',
backupDuration: 3600 * 1000 // 1 hour
shouldBackUp: true,
cloud: {
ut: {
apiKey: '...'
}
}
});

// # list of available logging method

logger.debug('hi this debug');
logger.warn('hello this is warn')
logger.error('hello this is error')
logger.info('hello this is info')
logger.silly('hello this is silly')
logger.custon('hello this is custom')

```

# API Reference

## LoggyOptions

To configure the Cloud Backup Service, users need to provide the following parameters:

- path: The path to the data to be backed up.
- formatMessageTemplate: The template for formatting log messages. Supported placeholders include {TIME}, {LEVEL}, and {MESSAGE}.
- backupDuration: The duration (in milliseconds) between backups. Default is set to 1 hour.
- shouldBackUp: A boolean indicating whether backups should be performed.
- cloud: Configuration for the cloud storage provider.
- ut: Configuration specific to the cloud provider. Currently, only API key is supported.
- apiKey: The API key for accessing the cloud storage provider.

0 comments on commit 6caff17

Please sign in to comment.