1 | /*!
|
2 | * Copyright 2021 Google LLC
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | /**
|
17 | * Common construct and functions used by both Log and LogSync
|
18 | */
|
19 | import { Entry } from '../entry';
|
20 | import { google } from '../../protos/protos';
|
21 | export interface WriteOptions {
|
22 | labels?: {
|
23 | [index: string]: string;
|
24 | };
|
25 | resource?: MonitoredResource;
|
26 | }
|
27 | export type MonitoredResource = google.api.IMonitoredResource;
|
28 | export declare enum Severity {
|
29 | emergency = 0,
|
30 | alert = 1,
|
31 | critical = 2,
|
32 | error = 3,
|
33 | warning = 4,
|
34 | notice = 5,
|
35 | info = 6,
|
36 | debug = 7
|
37 | }
|
38 | export type SeverityNames = keyof typeof Severity;
|
39 | export type LogSeverityFunctions = {
|
40 | [P in SeverityNames]: Function;
|
41 | };
|
42 | /**
|
43 | * snakecaseKeys turns label keys from camel case to snake case.
|
44 | * @param labels
|
45 | */
|
46 | export declare function snakecaseKeys(labels: {
|
47 | [p: string]: string;
|
48 | } | null | undefined): {
|
49 | [p: string]: string;
|
50 | } | null | undefined;
|
51 | /**
|
52 | * Return an array of log entries with the desired severity assigned.
|
53 | *
|
54 | * @private
|
55 | *
|
56 | * @param {object|object[]} entries - Log entries.
|
57 | * @param {string} severity - The desired severity level.
|
58 | */
|
59 | export declare function assignSeverityToEntries(entries: Entry | Entry[], severity: string): Entry[];
|
60 | /**
|
61 | * Format the name of a log. A log's full name is in the format of
|
62 | * 'projects/{projectId}/logs/{logName}'.
|
63 | *
|
64 | * @param projectId
|
65 | * @param name
|
66 | */
|
67 | export declare function formatLogName(projectId: string, name: string): string;
|