singleton-client-test 0.7.7.1 → 0.7.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sgtn-client/api/source.rb +0 -1
- data/lib/sgtn-client/api/translation.rb +41 -29
- data/lib/sgtn-client/common/data.rb +1 -1
- data/lib/sgtn-client/common/single_operation.rb +7 -8
- data/lib/sgtn-client/core/cache.rb +11 -14
- data/lib/sgtn-client/core/config.rb +56 -170
- data/lib/sgtn-client/i18n_backend.rb +7 -5
- data/lib/sgtn-client/loader/cache.rb +23 -36
- data/lib/sgtn-client/loader/loader_factory.rb +5 -4
- data/lib/sgtn-client/loader/local_translation.rb +3 -3
- data/lib/sgtn-client/loader/server.rb +4 -4
- data/lib/sgtn-client/loader/single_loader.rb +22 -19
- data/lib/sgtn-client/loader/source.rb +3 -3
- data/lib/sgtn-client/loader/source_comparer.rb +1 -1
- data/lib/sgtn-client/loader.rb +1 -0
- data/lib/sgtn-client/sgtn-client.rb +44 -86
- data/lib/sgtn-client/util/cache-util.rb +1 -9
- data/lib/sgtn-client/util/locale-util.rb +60 -27
- data/lib/sgtn-client/util/string-util.rb +5 -2
- data/lib/sgtn-client/util/validate-util.rb +9 -19
- data/lib/singleton-client.rb +12 -2
- metadata +20 -55
- data/lib/sgtn-client/core/logging.rb +0 -53
@@ -1,53 +0,0 @@
|
|
1
|
-
# Copyright 2022 VMware, Inc.
|
2
|
-
# SPDX-License-Identifier: EPL-2.0
|
3
|
-
|
4
|
-
require 'logger'
|
5
|
-
require 'time'
|
6
|
-
|
7
|
-
module SgtnClient
|
8
|
-
|
9
|
-
# Include Logging module to provide logger functionality.
|
10
|
-
# == Configure logger
|
11
|
-
# Logging.logger = Logger.new(STDERR)
|
12
|
-
#
|
13
|
-
# == Example
|
14
|
-
# include Logger
|
15
|
-
# logger.info "Debug message"
|
16
|
-
module Logging
|
17
|
-
|
18
|
-
# Get logger object
|
19
|
-
def logger
|
20
|
-
@logger ||= Logging.logger
|
21
|
-
end
|
22
|
-
|
23
|
-
def log_event(message, &block)
|
24
|
-
start_time = Time.now
|
25
|
-
block.call
|
26
|
-
ensure
|
27
|
-
logger.info sprintf("[%.3fs] %s", Time.now - start_time, message)
|
28
|
-
end
|
29
|
-
|
30
|
-
class << self
|
31
|
-
|
32
|
-
# Get or Create configured logger based on the default environment configuration
|
33
|
-
def logger
|
34
|
-
@logger ||= Logger.new(STDERR)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Set logger directly and clear the loggers cache.
|
38
|
-
# === Attributes
|
39
|
-
# * <tt>logger</tt> -- Logger object
|
40
|
-
# === Example
|
41
|
-
# Logging.logger = Logger.new(STDERR)
|
42
|
-
def logger=(logger)
|
43
|
-
@logger = logger
|
44
|
-
if Config.config.mode.eql? 'live' and @logger.level == Logger::DEBUG
|
45
|
-
@logger.warn "DEBUG log level not allowed in live mode for security of confidential information. Changing log level to INFO..."
|
46
|
-
@logger.level = Logger::INFO
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|