Skip to content

Commit

Permalink
refactor: logger level to logger min severity
Browse files Browse the repository at this point in the history
Conforms with cardano-rosetta
  • Loading branch information
rhyslbw committed Jan 28, 2021
1 parent 31e1806 commit 3e2ac84
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Expand Up @@ -101,7 +101,7 @@ services:
environment:
- ALLOW_INTROSPECTION=true
- CACHE_ENABLED=true
- LOGGER_LEVEL=${LOGGER_LEVEL:-info}
- LOGGER_MIN_SEVERITY=${LOGGER_MIN_SEVERITY:-info}
expose:
- ${API_PORT:-3100}
ports:
Expand Down
4 changes: 2 additions & 2 deletions nix/nixos/cardano-graphql-service.nix
Expand Up @@ -53,7 +53,7 @@ in {
default = "allegra";
};

logLevel = lib.mkOption {
loggerMinSeverity = lib.mkOption {
type = lib.types.str;
default = "info";
};
Expand Down Expand Up @@ -156,7 +156,7 @@ in {
HASURA_GRAPHQL_ENABLE_TELEMETRY = false;
HASURA_URI = hasuraBaseUri;
JQ_PATH = pkgs.jq + "/bin/jq";
LOGGER_LEVEL = cfg.logLevel;
LOGGER_MIN_SEVERITY = cfg.loggerMinSeverity;
POSTGRES_DB = cfg.db;
POSTGRES_HOST = cfg.dbHost;
POSTGRES_PASSWORD = cfg.dbPassword;
Expand Down
8 changes: 4 additions & 4 deletions packages/server/src/config.ts
Expand Up @@ -5,7 +5,7 @@ import { Config as ServerConfig } from './Server'
import { LogLevelString } from 'bunyan'

export type Config = ServerConfig & ApiCardanoDbHasuraConfig & {
loggerLevel: LogLevelString
loggerMinSeverity: LogLevelString
}

export async function getConfig (): Promise<Config> {
Expand Down Expand Up @@ -63,7 +63,7 @@ export async function getConfig (): Promise<Config> {
currentEraFirstSlot: env.currentEraFirstSlot || 16588800,
db,
eraName: env.eraName || 'allegra',
loggerLevel: env.loggerLevel || 'info' as LogLevelString,
loggerMinSeverity: env.loggerMinSeverity || 'info' as LogLevelString,
jqPath: env.jqPath || 'jq',
listenAddress: env.listenAddress || '0.0.0.0',
pollingIntervalAdaSupply: env.pollingIntervalAdaSupply || 1000 * 60,
Expand All @@ -88,7 +88,7 @@ function filterAndTypecastEnvs (env: any) {
HASURA_URI,
JQ_PATH,
LISTEN_ADDRESS,
LOGGER_LEVEL,
LOGGER_MIN_SEVERITY,
POLLING_INTERVAL_ADA_SUPPLY,
POSTGRES_DB,
POSTGRES_DB_FILE,
Expand Down Expand Up @@ -120,7 +120,7 @@ function filterAndTypecastEnvs (env: any) {
hasuraUri: HASURA_URI,
jqPath: JQ_PATH,
listenAddress: LISTEN_ADDRESS,
loggerLevel: LOGGER_LEVEL as LogLevelString,
loggerMinSeverity: LOGGER_MIN_SEVERITY as LogLevelString,
pollingIntervalAdaSupply: Number(POLLING_INTERVAL_ADA_SUPPLY),
postgresDb: POSTGRES_DB,
postgresDbFile: POSTGRES_DB_FILE,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/index.ts
Expand Up @@ -9,7 +9,7 @@ export * from './config'
const config = await getConfig()
const logger: Logger = createLogger({
name: 'cardano-graphql',
level: config.loggerLevel
level: config.loggerMinSeverity
})
try {
const server = await CompleteApiServer(config, logger)
Expand Down

0 comments on commit 3e2ac84

Please sign in to comment.