# force-logger

> simple but powerful logger system on JSON (save and search)

Latest version **2.1.2** (published 2016-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install force-logger
pnpm add force-logger
yarn add force-logger
bun add force-logger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2016-09-13 |
| First published | 2016-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Force1267 |
| Maintainers | force1267 |
| Keywords | log, search |

## Links

- npm: https://www.npmjs.com/package/force-logger
- Repository: https://github.com/force1267/force-logger
- Homepage: https://github.com/force1267/force-logger#readme
- Issues: https://github.com/force1267/force-logger/issues
- npm.io page: https://npm.io/package/force-logger

## Dependencies (1)

- [jsop](https://npm.io/package/jsop.md) *

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.1.2 (latest) — 2016-09-13
- 1.1.2 — 2016-09-13
- 1.1.1 — 2016-09-12
- 1.1.0 — 2016-09-11
- 1.0.0 — 2016-09-05

## README

# force-logger
-------------------------------------------------------------

> Simple but powerful logger system on JSON (save and search)

##Install :

> npm install force-logger

1-Create masterLog's dir (any name)

2-Create masterLog's/Logs dir (name must be logs)

3-flog = require("force-logger")("dirToMasterLog's folder" ,optionalStartTime : Javascript Date())

##New log :
```javascript
options = {
  time : optional Javascript Date() // default is now
  ,info : optional object // with any information in it
  ,msg : optional string
  ,tags : optional array // of strings. default is ["default"]
}

flog.log(options)
// your log is now saved inside latest logfile inside masterlog's/logs dir
```

##Search in saved logs :
```javascript
options = {
  from : optional Javascript Date() // default is require("force-logger")()'s time
  ,to : optional Javascript Date() // default is now
  ,tags : optional array // of strings. default is ["default"]
  ,nots : optional array // of srtings. default is []
}

flog.search(options)
// returns an array of saved log objects that have one of options.tags and non of options.nots between options.from to options.to
```
_search will be updated with more features_

##Work with tags
```javascript
flog.getTags()
// returns array of tags used in project
flog.setDefaultTags(tags:array)
// sets default tag array. returns true. use this to set all tags used in project. (also new tags will be added automaticaly)
```
__Use masterLog.json__
```javascript
flog.getMasterFile()
/* returns masterLog.json object (readable and writable).
any change to this object will change the file.
for more info of how this works see
https://www.npmjs.com/package/jsop , https://github.com/typicode/jsop
*/
```
```javascript
masterLog_json = {
  start : javascript Date()
  ,tags : array //of strings. default tags
  ,logNum : number //of logs
  ,logFiles = [
    start : javascript Date()
    num : number //of this log
  ]
}
```

#Change log:
#2.1.2:
-search returns an array of saved log objects that have _one_ of options.tags (instead of _all_)

-added flog.setDefaultTags(tags:array) , sets masterLog.json default tag array. returns true. use this to set all tags used in project. (also new tags will be added automaticaly)

-added flog.getTags() , returns array of tags used in project

-added flog.getMasterFile() , returns masterLog.json object (readable and writable). any change to this object will change the file.
see https://www.npmjs.com/package/jsop , https://github.com/typicode/jsop

#1.1.2:
-bugFix

-Does the job correctly

#1.1.1:
-bugFix

#1.1.0:
-search returns an array of saved log objects that have _all_ of options.tags (instead of _one_)

-added options.nots, search returns an array of logs that have _non_ of options.nots

---
_Source: https://npm.io/package/force-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
