0.5.4 • Published 9 days ago

@blackglory/logger-js v0.5.4

Weekly downloads
287
License
MIT
Repository
github
Last release
9 days ago

logger-js

Install

npm install --save @blackglory/logger-js
# or
yarn add @blackglory/logger-js

API

interface ILog {
  id: string
  payload: string
}
interface IJsonLog {
  id: string
  payload: Json
}

LoggerClient

new LoggerClient({
  server: string
, token?: string
, keepalive?: boolean
, timeout?: number
, heartbeat?: IHeartbeatOptions
})
interface ILoggerClientRequestOptions {
  signal?: AbortSignal
  token?: string
  keepalive?: boolean
  timeout?: number | false
}
interface ILoggerClientRequestOptionsWithoutToken {
  signal?: AbortSignal
  keepalive?: booolean
  timeout?: number | false
}
interface ILoggerClientObserveOptions {
  token?: string
  heartbeat?: IHeartbeatOptions
}
interface IHeartbeatOptions {
  timeout: number
}

write

LoggerClient#write(
  namespace: string
, val: string
, options?: ILoggerClientRequestOptions
): Promise<void>

writeJSON

LoggerClient#writeJSON(
  namespace: string
, val: Json
, options?: ILoggerClientRequestOptions
): Promise<void>

follow

LoggerClient#follow(
  namespace: string
, options?: ILoggerClientObserveOptions
): Observable<ILog>

followJSON

LoggerClient#followJSON(
  namespace: string
, options?: ILoggerClientObserveOptions
): Observable<IJsonLog>

query

LoggerClient#query(
  namespace: string
, query: {
    from?: string
    to?: string
    head?: number
    tail?: number
  }
, options?: ILoggerClientRequestOptions
): Promise<ILog[]>

queryJSON

LoggerClient#queryJSON(
  namespace: string
, query: {
    from?: string
    to?: string
    head?: number
    tail?: number
  }
, options?: ILoggerClientRequestOptions
): Promise<Array<IJsonLog>>

del

LoggerClient#del(
  namespace: string
, query: {
    from?: string
    to?: string
    head?: number
    tail?: number
  }
, options?: ILoggerClientRequestOptions
): Promise<void>

getAllNamespaces

LoggerClient#getAllNamespaces(options?: ILoggerClientRequestOptionsWithoutToken): Promise<string[]>

LoggerManager

new LoggerManager({
  server: string
, adminPassword: string
, keepalive?: boolean
, timeout?: number
})
interface ILoggerManagerRequestOptions {
  signal?: AbortSignal
  keepalive?: boolean
  timeout?: number | false
}

JsonSchema

getNamespaces
LoggerManager#JsonSchema.getNamespaces(
  options?: ILoggerManagerRequestOptions
): Promise<string[]>
get
LoggerManager#JsonSchema.get(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<Json>
set
LoggerManager#JsonSchema.set(
  namespace: string
, schema: Json
, options?: ILoggerManagerRequestOptions
): Promise<void>
remove
LoggerManager#JsonSchema.remove(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>

PurgePolicy

getNamespaces
LoggerManager#PurgePolicy.getNamespaces(
  options?: ILoggerManagerRequestOptions
): Promise<string[]>
get
LoggerManager#PurgePolicy.get(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<{
  timeToLive: number | null
  limit: number | null
}>
setTimeToLive
LoggerManager#PurgePolicy.setTimeToLive(
  namespace: string
, val: number
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeTimeToLive
LoggerManager#PurgePolicy.removeTimeToLive(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
setLimit
LoggerManager#PurgePolicy.setLimit(
  namespace: string
, val: boolean
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeLimit
LoggerManager#PurgePolicy.removeLimit(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
purge
LoggerManager#PurgePolicy.purge(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>

Blacklist

getNamespaces
LoggerManager#Blacklist.getNamespaces(
  options?: ILoggerManagerRequestOptions
): Promise<string[]>
add
LoggerManager#Blacklist.add(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
remove
LoggerManager#Blacklist.remove(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>

Whitelist

getNamespaces
LoggerManager#Whitelist.getNamespaces(
  options?: ILoggerManagerRequestOptions
): Promise<string[]>
add
LoggerManager#Whitelist.add(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
remove
LoggerManager#Whitelist.remove(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>

TokenPolicy

getNamespaces
LoggerManager#TokenPolicy.getNamespaces(
  options?: ILoggerManagerRequestOptions
): Promise<string[]>
get
LoggerManager#TokenPolicy.get(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<{
  writeTokenRequired: boolean | null
  readTokenRequired: boolean | null
  deleteTokenRequired: boolean | null
}>
setWriteTokenRequired
LoggerManager#TokenPolicy.setWriteTokenRequired(
  namespace: string
, val: boolean
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeWriteTokenRequired
LoggerManager#TokenPolicy.removeWriteTokenRequired(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
setReadTokenRequired
LoggerManager#TokenPolicy.setReadTokenRequired(
  namespace: string
, val: boolean
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeReadTokenRequired
LoggerManager#TokenPolicy.removeReadTokenRequired(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
setDeleteTokenRequired
LoggerManager#TokenPolicy.setDeleteTokenRequired(
  namespace: string
, val: boolean
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeDeleteTokenRequired
LoggerManager#TokenPolicy.removeDeleteTokenRequired(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<void>

Token

getNamespaces
LoggerManager#Token.getNamespaces(options?: ILoggerManagerRequestOptions): Promise<string[]>
getTokens
LoggerManager#Token.getTokens(
  namespace: string
, options?: ILoggerManagerRequestOptions
): Promise<Array<{
  token: string
  write: boolean
  read: boolean
  delete: boolean
}>>
addWriteToken
LoggerManager#Token.addWriteToken(
  namespace: string
, token: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeWriteToken
LoggerManager#Token.removeWriteToken(
  namespace: string
, token: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
addReadToken
LoggerManager#Token.addReadToken(
  namespace: string
, token: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeReadToken
LoggerManager#Token.removeReadToken(
  namespace: string
, token: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
addDeleteToken
LoggerManager#Token.addDeleteToken(
  namespace: string
, token: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
removeDeleteToken
LoggerManager#Token.removeDeleteToken(
  namespace: string
, token: string
, options?: ILoggerManagerRequestOptions
): Promise<void>
0.5.4

9 days ago

0.5.3

11 days ago

0.5.2

12 days ago

0.5.1

3 months ago

0.5.0

5 months ago

0.4.5

5 months ago

0.4.4

5 months ago

0.4.3

6 months ago

0.4.2

6 months ago

0.4.1

6 months ago

0.4.0

7 months ago

0.3.19

7 months ago

0.3.18

7 months ago

0.3.16

7 months ago

0.3.15

7 months ago

0.3.14

7 months ago

0.3.13

7 months ago

0.3.12

7 months ago

0.3.11

7 months ago

0.3.9

7 months ago

0.3.10

7 months ago

0.3.8

7 months ago

0.3.6

7 months ago

0.3.5

7 months ago

0.3.4

8 months ago

0.3.3

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.2.2

8 months ago

0.1.15

8 months ago

0.1.16

8 months ago

0.1.14

8 months ago

0.1.13

9 months ago

0.1.12

9 months ago

0.1.11

9 months ago

0.1.10

9 months ago

0.1.9

9 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.2

10 months ago

0.1.3

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago