Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDBInstance(logDB *custlogger.Logger, schema string) *gorm.DB
- func GetDB(ctx *gin.Context) *gorm.DB
- func GetDBOverride(ctx *gin.Context) *gorm.DB
- func InitDB(reset bool, schema string, logDB *custlogger.Logger) *gorm.DB
- func NewCustomLogger(writer Writer, config Config) logger.Interface
- type Config
- type LogLevel
- type Writer
Constants ¶
View Source
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" BlueBold = "\033[34;1m" MagentaBold = "\033[35;1m" RedBold = "\033[31;1m" YellowBold = "\033[33;1m" )
Colors
View Source
const SchemaDev = "dev"
SchemaDev used for dev
View Source
const SchemaProd = "public"
SchemaProd used for prod
View Source
const SchemaTest = "test"
SchemaTest used for tests
View Source
const SchemaTestAnalyzer = "testanalyzer"
SchemaTestAnalyzer used to test the analyzer
View Source
const SchemaTestAnalyzerDownload = "testanalyzerdownload"
SchemaTestAnalyzerDownload used to test the downloaders
View Source
const SchemaTestController = "testcontroller"
SchemaTestController used to test the dao
View Source
const SchemaTestDao = "testdao"
SchemaTestDao used to test the controller
View Source
const SchemaTestDemoClassifier = "testdemoclassifier"
SchemaTestDemoClassifier used to test the demo classifier
View Source
const SchemaTestModel = "testmodel"
SchemaTestModel used to test the model
View Source
const SchemaTestServer = "testserver"
SchemaTestServer used to test the server
Variables ¶
View Source
var ( Discard = NewCustomLogger(log.New(ioutil.Discard, "", log.LstdFlags), Config{}) Default = NewCustomLogger(log.New(os.Stdout, "\r\n", log.LstdFlags), Config{ SlowThreshold: 1000 * time.Millisecond, LogLevel: logger.Info, Colorful: false, }) Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()} )
some logger pre-configured
View Source
var ErrRecordNotFound = errors.New("record not found")
ErrRecordNotFound record not found
Functions ¶
func CreateDBInstance ¶
func CreateDBInstance(logDB *custlogger.Logger, schema string) *gorm.DB
CreateDBInstance Création de l'instance de la DB
func GetDBOverride ¶
GetDBOverride récupérer la DB, elle ne sera jamais rollback
Types ¶
type Config ¶
type Config struct { SlowThreshold time.Duration Colorful bool IgnoreRecordNotFoundError bool LogLevel logger.LogLevel }
Config the configuration of the logger
Click to show internal directories.
Click to hide internal directories.