github.com/braveheart12/just@v0.8.7/core/logger.go (about)

     1  /*
     2   *    Copyright 2019 Insolar Technologies
     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  package core
    18  
    19  import "io"
    20  
    21  // Logger is the interface for loggers used in the Insolar components.
    22  type Logger interface {
    23  	// SetLevel sets log level.
    24  	SetLevel(string) error
    25  
    26  	// Debug logs a message at level Debug.
    27  	Debug(...interface{})
    28  	// Debugf formatted logs a message at level Debug.
    29  	Debugf(string, ...interface{})
    30  
    31  	// Info logs a message at level Info.
    32  	Info(...interface{})
    33  	// Infof formatted logs a message at level Info.
    34  	Infof(string, ...interface{})
    35  
    36  	// Warn logs a message at level Warn.
    37  	Warn(...interface{})
    38  	// Warnf logs a message at level Warn.
    39  	Warnf(string, ...interface{})
    40  
    41  	// Error logs a message at level Error.
    42  	Error(...interface{})
    43  	// Errorf logs a message at level Error.
    44  	Errorf(string, ...interface{})
    45  
    46  	// Fatal logs a message at level Fatal and than call os.exit().
    47  	Fatal(...interface{})
    48  	// Fatalf formatted logs a message at level Fatal and than call os.exit().
    49  	Fatalf(string, ...interface{})
    50  
    51  	// Panic logs a message at level Panic and than call panic().
    52  	Panic(...interface{})
    53  	// Panicf formatted logs a message at level Panic and than call panic().
    54  	Panicf(string, ...interface{})
    55  
    56  	// SetOutput sets the output destination for the logger.
    57  	SetOutput(w io.Writer)
    58  	// WithFields return copy of Logger with predefined fields.
    59  	WithFields(map[string]interface{}) Logger
    60  	// WithField return copy of Logger with predefined single field.
    61  	WithField(string, interface{}) Logger
    62  }