Class: GoogleCloud::LoggingService::Logger
- Inherits:
-
Object
- Object
- GoogleCloud::LoggingService::Logger
- Defined in:
- lib/google_cloud/logging_service/logger.rb
Constant Summary collapse
- WRITE_URL =
"https://logging.googleapis.com/v2/entries:write"
- SCOPE =
"https://www.googleapis.com/auth/logging.write"
Instance Method Summary collapse
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #log(client_email, private_key, payload) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
9 10 11 |
# File 'lib/google_cloud/logging_service/logger.rb', line 9 def initialize @auth = GoogleCloud::Authentication.new(scope: SCOPE) end |
Instance Method Details
#log(client_email, private_key, payload) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/google_cloud/logging_service/logger.rb', line 13 def log(client_email, private_key, payload) access_token = @auth.generate_access_token(client_email, private_key) return unless access_token headers = build_headers(access_token) post(WRITE_URL, body: payload, headers: headers) end |